Skip to main content
Yoryantra
← Back to Tools

Shell Command Escape Tool

Quote one argument for POSIX or PowerShell and expose CMD and dotenv context limits before copying.

Paste a path, argument value, copied command text, token-like string, .env value, or text that needs safer command-line quoting.

Escape Settings

Options

Nothing is executed. Quoting one argument is also different from validating an entire command, and Windows CMD or dotenv syntax can depend on the exact caller and parser.

Quoting is grammar-specific, not a universal escape operation

A literal argument that is correct in a POSIX shell is not automatically correct in PowerShell or cmd.exe. The strongest output on this page is a quoted single argument for the selected grammar. It is not a review of a whole command line and it never approves pasted command text for execution.

POSIX single quotes

Single quotes preserve every enclosed character literally. Because a single quote cannot occur inside that quote pair, an embedded apostrophe is represented by closing the quote, adding an escaped quote, then reopening it.

PowerShell single quotes

PowerShell single-quoted strings are verbatim strings; an embedded single quote is written twice. Passing that value to a native executable can still involve PowerShell's native-argument serialization rules.

Why CMD is deliberately marked context-sensitive

cmd.exe has several parsing layers. Carets and quotes can protect metacharacters such as &, |, <, and >, but percent expansion, delayed ! expansion, batch-file rules, cmd /c quote stripping, and the target program's own argument parser can change the result. The CMD output here is therefore a reviewable fragment, not a universal escaping guarantee.

Dotenv files do not share one universal quoting grammar

The dotenv option produces a conservative double-quoted representation with escaped backslashes, quotes, CR and LF. Node, Docker Compose, libraries, CI systems, and application frameworks do not all parse dotenv files identically. Check the parser that will actually load the file before treating the generated value as portable.

Unescape is intentionally best-effort

Shell source cannot in general be reversed by string replacement because parsing may involve expansions, concatenated quote segments, command substitution, variables, redirection and multiple arguments. Unescape mode only reverses the narrow quote forms generated here; it is not a shell parser.

Security boundary

The browser never runs the pasted command. Treat real tokens, passwords and API keys as sensitive even when processing is local, because copied output can still end up in shell history, logs, screenshots, tickets or source control.

Authoritative syntax references

POSIX quoting rules are defined by The Open Group Shell Command Language. Microsoft documents PowerShell quoting and cmd.exe parsing and special characters separately.