Here somthing I want to do.
start /wait ((c:\Program Files\NetDrive2\nd2cmd.exe) -c m -t ftp -blabla)
If I do
start /wait "c:\Program Files\NetDrive2\nd2cmd.exe -c m -t ftp -blabla"
Then there is an error because "Program Files" has a space.
If I do
start /wait "c:\Program Files\NetDrive2\nd2cmd.exe" -c m -t ftp -blabla
Then it interprets the argument for start
so it also generates an error.
Is there anyway to overlap the equation like bracket in normal program language?
Generally, to differentiate commands from other types of instructions, enclose the command within single or double quotation marks. When issuing TSO/E commands in an exec, it is recommended that you enclose them in double quotation marks.
In Windows, you can type any character you want by holding down the ALT key, typing a sequence of numbers, then releasing the ALT key.
Escape every double quote " with a caret ^ . If you want other characters with special meaning to the Windows command shell (e.g., < , > , | , & ) to be interpreted as regular characters instead, then escape them with a caret, too.
Use double percent signs ( %% ) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %a, %b, or %c. ( <set> ) Required. Specifies one or more files, directories, or text strings, or a range of values on which to run the command.
Reference Start - Start a program, command or batch script (opens in a new window.)
Syntax
START "title" [/D path] [options] "command" [parameters]
Key:
title
Text for the CMD window title bar (required.)
path
Starting directory.
command
The command, batch file or executable program to run.
parameters
The parameters passed to the command.
...
Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes "". According to the Microsoft documentation, the title is optional, but you may will have problems if it is omitted.
The reason you have an error if title
is omitted is because the first "
character (if present) will be used to delimit the title, so start
will interpret "Program Files"
as a title.
If there are no "
characters then title
can be omitted.
Your command should look like:
start /wait "My title" "c:\Program Files\NetDrive2\nd2cmd.exe" -c m -t ftp -blabla
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With