Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use quotes in cmd start?

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?

like image 902
user2958279 Avatar asked Dec 03 '14 00:12

user2958279


People also ask

How do you use quotation marks in CMD?

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.

How do I use special characters in CMD?

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.

How do you escape quotes in CMD?

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.

What does %% mean in CMD?

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.


1 Answers

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
like image 183
DavidPostill Avatar answered Oct 28 '22 15:10

DavidPostill