Jump to content

calling cmd.exe file with arguments


Recommended Posts

Guest czechboy
Posted

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

  • Replies 8
  • Created
  • Last Reply
Posted

Re: calling cmd.exe file with arguments

 

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" <oldrich.svec@centrum.cz> wrote in message

news:2d4d3b6f-08f3-4e01-aa20-530437222c37@f36g2000hsa.googlegroups.com...

> 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

Guest Pegasus \(MVP\)
Posted

Re: calling cmd.exe file with arguments

 

 

"czechboy" <oldrich.svec@centrum.cz> wrote in message

news:2d4d3b6f-08f3-4e01-aa20-530437222c37@f36g2000hsa.googlegroups.com...

> 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"

Guest czechboy
Posted

Re: calling cmd.exe file with arguments

 

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...

Guest czechboy
Posted

Re: calling cmd.exe file with arguments

 

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 :)

Guest czechboy
Posted

Re: calling cmd.exe file with arguments

 

Finaly solved :)

Guest someone watching
Posted

and the answer is?

 

and the answer is?

 

enlighten us!

___

"czechboy" <oldrich.svec@centrum.cz> wrote in message

news:b1701082-c777-45b0-bcb7-bc76b8df7c79@u3g2000hsc.googlegroups.com...

> Finaly solved :)

  • 2 months later...
Guest ernperkins
Posted

Re: calling cmd.exe file with arguments

 

 

I'm having the same exact problem. What was the solution?

 

Thanks,

Ed Perkins

 

 

--

ernperkins

Guest Pegasus \(MVP\)
Posted

Re: calling cmd.exe file with arguments

 

 

"ernperkins" <ernperkins@msn.com> wrote in message

news:ernperkins.3bdku7@no-mx.tabletquestions.com...

>

> I'm having the same exact problem. What was the solution?

>

> Thanks,

> Ed Perkins

>

>

> --

> ernperkins

 

I assume you're referring to a thread that is more than two months

old. Since you removed all of the original text, it is not possible to

be sure. Have a look here - maybe this is what you're after:

http://www.technologyquestions.com/technology/windows-xp/221452-calling-cmd-exe-file-arguments.html


×
×
  • Create New...