简体   繁体   中英

Bat file works manually but not from python subprocess call

I was trying to start/stop netsh trace in Windows10. Created a python and bat file to do the same.

When I try.bat file manually in command prompt it is working but not working using python subprocess call.

Python code:

 subprocess.call([r'C:\Tools\Netsh\startTrace.bat'])

Bat File:

netsh trace start persistent=yes capture=yes tracefile=C:\Netsh\nettrace.etl

Any suggestion on the next step are welcome

Try:

subprocess.call((r"C:\Tools\Netsh\startTrace.bat") shell = True) or subprocess.Popen...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM