问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/27261692/how-do-i-use-quotes-in-cmd-start