約using command redirection operators微軟的文章介紹使用>
或>>
或|
的差異。
跟隨線路有什麼問題?
start "" php index.php 1 2 >>tmp1.txt
在附加命令的輸出此行的結果開始到文件tmp1.txt
這裏沒有希望。
解決方案是什麼?
重定向操作符由用於命令命令處理器不再解釋通過與^
逸出角括號開始,但對於在php.exe
一個新的命令處理開始。
start "" php.exe index.php 1 2 ^>^>tmp1.txt
start "" php.exe index.php 3 4 ^>^>tmp2.txt
兩條線的缺點上面是每個控制檯窗口中打開每個新的進程仍然之後php.exe
加工成品腳本文件index.php
開放。
將溶液使用具有啓動一個新的命令處理與選項/C
php.exe
終止後自動關閉命令過程及其控制檯窗口已經提供由Aacini的代碼。
start "" cmd.exe /C php.exe index.php 1 2 ^>^>tmp1.txt
start "" cmd.exe /C php.exe index.php 3 4 ^>^>tmp2.txt
重定向也可以指定在應用程序的左側,輸出被重定向並附加到指定的文件。
start "" cmd.exe /C ^>^>tmp1.txt php.exe index.php 1 2
start "" cmd.exe /C ^>^>tmp2.txt php.exe index.php 3 4
可能存在間距問題。嘗試將'>> tmp1.txt'和'>> tmp2.txt'放在各自行的開頭。 – SomethingDark
Nop。它只是有相同的結果。 – Kibo
'開始「」cmd/C ^> ^> tmp1.txt php index.php 1 2' – Aacini