calling cmd.exe file with arguments

  • Thread starter Thread starter czechboy
  • Start date Start date
C

czechboy

Hi,
I have the following code:

C:\WINDOWS\system32\cmd.exe /C "C:\Program Files\FindAndRunRobot
\Plugins\TodoTXT\dist\todo.exe a test"

I want to call todo.exe with a parameter "a test". How to do it
correctly?
Thank you
Oldrich Svec
 
Do you want the command window to stay open?

cmd.exe /C Carries out the command specified by string and
then terminates

cmd.exe /K Carries out the command specified by string but
remains


Your quote is in the wrong place. Only quote the path, not
switches.

C:\WINDOWS\system32\cmd.exe /C "C:\Program Files\FindAndRunRobot
\Plugins\TodoTXT\dist\todo.exe" a test


ju.c
 
czechboy said:
Hi,
I have the following code:

C:\WINDOWS\system32\cmd.exe /C "C:\Program Files\FindAndRunRobot
\Plugins\TodoTXT\dist\todo.exe a test"

I want to call todo.exe with a parameter "a test". How to do it
correctly?
Thank you
Oldrich Svec

You have a couple of options:

- The simple way:
"C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\dist\todo.exe" "a test"
(There is no need to invoke an extra Command Processor)

- Making life harder for yourself:
C:\WINDOWS\system32\cmd.exe /C "C:\Program
Files\FindAndRunRobot\Plugins\TodoTXT\dist\todo.exe" "a test"
 
Thank you for your answer. I want to call a program from jscript by
oShell.Run(command, 0, true) The problem I have now is that if the
following

"C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\dist\todo.exe" a
test > "C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\temp.tmp"

is my "command" variable then it treats ">" as another parameter for
todo.exe, but I want to output the result into the temp.tmp file.

The same is with:

"C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\dist\todo.exe" "a"
"test" > "C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\temp.tmp"

If I try

"C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\dist\todo.exe" "a
test" > "C:\Program Files\FindAndRunRobot\Plugins\TodoTXT\temp.tmp"

todo.exe treats it badly...
 
I have even tried

C:\WINDOWS\system32\cmd.exe /C "C:\Program Files\FindAndRunRobot
\Plugins\TodoTXT\dist\todo.exe" a skola > "C:\Program Files
\FindAndRunRobot\Plugins\TodoTXT\temp.tmp"

and it works when called from xplorer2, but it doesnt work when called
from jscript.. I am quite lost :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top