rsk82
rsk82

Reputation: 29397

how redirect output of a *.cmd file that contains start command to a file?

If I put on a console this command:

start /b /belownormal /wait php.exe script.php > output.txt

All goes well, but if I put the same command but without redirection to a *.cmd file and then do redirection on that file:

So the file myscript.cmd is as follows:

start /b /belownormal /wait php.exe script.php

And command I have problem with is:

myscript.cmd > output.txt

The output.txt is being created but is empty. Is there any other way to run any command line application with 'below normal' priority and be able to redirect output to a file ?

(Of course this has nothing to do particularly with php. Any command has this effect even simple echo.)

Upvotes: 2

Views: 2749

Answers (2)

James Mnatzaganian
James Mnatzaganian

Reputation: 1285

Try escaping the redirection with a caret, ^, i.e.

myscript.cmd ^> output.txt

Upvotes: 1

Aacini
Aacini

Reputation: 67236

Perhaps this trick may solve your problem. myscript.cmd:

start /b /belownormal /wait php.exe script.php %~1

and call it this way:

myscript.cmd "> output.txt"

Upvotes: 3

Related Questions