【发布时间】:2012-04-26 14:28:58
【问题描述】:
如果我把这个命令放在控制台上:
start /b /belownormal /wait php.exe script.php > output.txt
一切顺利,但如果我输入相同的命令但没有重定向到 *.cmd 文件,然后对该文件进行重定向:
所以文件myscript.cmd如下:
start /b /belownormal /wait php.exe script.php
我有问题的命令是:
myscript.cmd > output.txt
正在创建 output.txt 但为空。 有没有其他方法可以运行具有“低于正常”优先级的任何命令行应用程序并能够将输出重定向到文件?
(当然这和php没有什么特别的关系。任何命令都有这个效果,即使是简单的回显。)
【问题讨论】:
-
也许你可以做到这一点:(在 1.bat 中)启动 /b /belownormal /wait 2.bat(在 2.bat 中)php.exe script.php > output.txt
-
在 Win7 64bit 上我无法重现上述行为
-
其次(Win7 SP1 64 位)。这些是我尝试重现该问题所采取的步骤:1)
echo @start /b /belownormal /wait cmd /c echo NOT every command has this effect> test.bat; 2)test.bat > testdir; 3)type testdir。猜猜最后一个命令的输出是什么?
标签: command-line batch-file windows-xp