Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line passing quotes within quotes

I've been searching for a solution to this but couldn't find one. Not sure if its possible.

Can I pass into command-line execution that passes a in a bat file which has an input file as its arguments?

So from the command-line it'll look like this:

C:\run.exe "C:\space folder\run.bat "C:\space folder\input.txt""

The problem is with the folders that has spaces so the quotes are required to be in there.

like image 809
user2617566 Avatar asked Dec 10 '13 01:12

user2617566


People also ask

How do you integrate a quote within a quote?

Quotations within a QuotationUse single quotation marks to enclose quotes within another quotation.

How do you pass quotes from the command line?

You should escape-protect the quote characters with a backslash in order for them to be treated as literal characters. For example, if you have a file called myfile. c'v , type it as myfile. c\'v when you call your program.

How do I escape double 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.

How do you quote within a quote in bash?

Sometimes it is required to print a single quote inside a string. A single quoted string can't contain another single quote inside the string. You can do this task by adding backslash in the front of single quote. In the following example, single quote of don't word is printed by using backslash.


1 Answers

Try this:

C:\run.exe "C:\space folder\run.bat \"C:\space folder\input.txt\""

And here is a link that you can see all escape characters http://www.robvanderwoude.com/escapechars.php

like image 183
Jorge Campos Avatar answered Oct 23 '22 14:10

Jorge Campos