문제

I would like to run a program and save its output into a file. The program starts, I see a cmd window pop-up, but the file is alway empty. I tryed these versions:

start snmpwalk.exe "parameters will be here" >text.txt
start snmpwalk.exe "parameters will be here" 2>&1 | out-file text.txt

Can you help me how to solve the problem?

Thanks

도움이 되었습니까?

해결책

You don't need to use start, you should be able to just use the command as normal from within powershell.

A slightly more powershell way would be to use invoke-expression

invoke-expression "snmpwalk [parameters]" | out-file text.text
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top