![](/img/trans.png)
[英]Is there any way to redirect stderr output from a command run with "start" in the Windows command line?
[英]Is there any way to redirect stderr output from a command run with “start” in the Windows command line?
我有一個要自動運行的程序,因為它需要一段時間才能完成。 由於某種原因,它會將所有內容輸出到stderr而不是stdout,並且我想檢查其進度,因此我發現自己需要在啟動命令中重定向stderr輸出。
我嘗試了這個:
start "My_Program" "C:\Users\Me\my_program.exe" --some --presets --for --my_program.exe --output "C:\Users\Me\output_file_for_my_program" "C:\Users\Me\input_file_for_my_program" 2>"C:\Users\Me\my_program_output.log"
但是事實證明重定向是由start進行的,因此我得到一個0字節的文件,其結果為“ start”-即什么也沒有。 有什么辦法可以使輸出重定向以某種方式附加到my_program的輸出上?
我已經嘗試過轉義,“ ^ 2>”和“ 2 ^>”似乎都沒有用。
如果“面向變通辦法的編程”是可以接受的(可能是,您正在對Windows Batch進行編程),則可以將有問題的代碼行放在另一個.BAT文件中,而無需任何“啟動”,然后“啟動”該另一個BAT。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.