Using Cmds Command Line Syntax

The complete command-line syntax for Cmd exe is cmd [/a | /u] [/q] [/d] [/e:on | /e:off] [/f:on | /f:off] [/v:on | /v:off] [[/s] [/c | /k] commandstring]

All arguments are optional The available arguments are as follows:

• /A | /U This argument lets you specify the encoding system used for text that's piped to a file or other device . Use /A for ANSI or /U for Unicode . (The default is ANSI.)

• /Q The /Q argument starts Command Prompt with echo off. (With echo off, you don't need to include an @Echo Off line to suppress screen output in a batch program . To turn echo back on after starting Command Prompt with /Q, type echo on at the command prompt.)

• /D The /D argument disables execution of any AutoRun commands specified in the registry. (For more information, see the preceding section .)

• /E:on | /E:off The /E argument allows you to override the current registry settings that affect command extensions, which are enhancements to several internal commands; some extensions might be incompatible with last-century programs or work habits . Command extensions are enabled by default. To disable extensions by default, set the DWORD value EnableExtensions in HKLM\Software\Microsoft\ Command Processor to 0.

• /F:on | /F:off The /F argument allows you to override the current registry settings regarding file-name and folder-name completion . (See "Using File-Name and Folder-Name Completion" on page 961 .)

• /V:on | /V:off The /V argument lets you enable or disable delayed variable expansion. With /V:on, for example, the variable !var! is expanded only when executed. The default is /V:off. To turn on delayed variable expansion as a default, add the DWORD value DelayedExpansion to HKLM\Software\Microsoft\Command Processor (for all users at the current machine) or HKCU\Software\Microsoft\ Command Processor (for the current user account only), and set DelayedExpansion to 1 . (Delayed variable expansion is useful in conditional statements and loop constructs in batch programs . For more information, type help set at the command prompt )

• /S [/C | /K] commandstring The alternative /C and /K arguments allow you to run a command when Command Prompt starts—with /C terminating the session at the command's completion and /K keeping it open . (For more information, see "Starting Command Prompt and Running a Command" on page 957. ) Including /S before /C or /K affects the processing of quotation marks in commandstring.

If you do not include /S, and there are exactly two quotation marks in command-string, and there are no "special" characters (&, <, >, (, ), @, A, or |) in commandstring, and there are one or more white-space characters (spaces, tabs, or linefeeds, for example) between the two quotation marks, and commandstring is the name of an executable file, then Command Prompt preserves the two quotation characters.

If the foregoing conditions are not met and if the first character in commandstring is a quotation mark, Command Prompt strips the first and last quotation marks from commandstring.

Was this article helpful?

0 0
Digital Cancers

Digital Cancers

Get All The Support And Guidance You Need To Be A Success At Protecting Your PC. This Book Is One Of The Most Valuable Resources In The World When It Comes To The Damaging Facts About Computer Viruses.

Get My Free Ebook

Post a comment