Sergiy Belozorov
Sergiy Belozorov

Reputation: 6064

How to escape parameter in windows command line?

I need to run the following command from the command line in Windows 7:

SumatraPDF.exe -inverse-search "\"C:\Program Files\eclipse\inverse_search.bat\" \"%f\" %l"

However I need to modify it a little, since my installation of Eclipse is located in here:

C:\Program Files (x86)\Eclipse (C++)

How do I escape this line correctly? Do I need to escape parenthesis and pluses too? Or is it just enough to escape double quotes?

Upvotes: 10

Views: 28464

Answers (3)

Luke
Luke

Reputation: 11421

I don't even think you need to escape the quotes; it should be enough to do:

SumatraPDF.exe -inverse-search ""C:\Program Files (x86)\Eclipse (C++)\inverse_search.bat" %f %l"

Upvotes: 1

Esteban Küber
Esteban Küber

Reputation: 36832

SumatraPDF.exe -inverse-search "\"C:\Program Files (x86)\Eclipse (C++)\inverse_search.bat\" \"%f\" %l"

Upvotes: 19

Sniggerfardimungus
Sniggerfardimungus

Reputation: 11831

When in doubt, escape everything. I find that I don't need to escape (), %, or +, though.

Upvotes: 3

Related Questions