3

Below executable return string values in command but when i execute below batch script it pop up different command line console and exits hence i am not getting any values in output.txt

how to capture this result ?

c:\ 
cd C:\Windows\System32  
start usbinvoke.exe argument >c:\result\outpput.txt
pause
Ardra Madhu
  • 157
  • 1
  • 2
  • 7

2 Answers2

3
usbinvoke.exe argument > C:\result\output.txt

Start starts programs in unusual ways. See start /?

See Command to run a .bat file

Your other commands are unnecessary.

You right click a shortcut to cmd and tick Run As Administrator on the compatibility tab

CatCat
  • 41
  • 2
2
c:\ 
cd C:\Windows\System32  
usbinvoke.exe argument >c:\result\output.txt
pause

start does not wait unless you use /wait argument. Suggest remove start and just run the executable.

You cannot redirect streams with a process that does not wait as the no handle is attached to the process.

If you require start then use arguments /b (same window) and /w (same as /wait).

michael_heath
  • 5,262
  • 2
  • 12
  • 22
  • You can shift rightclick and run as admin. Internally handled, try the answer [How to get admin privilege in cmd for running sc.exe?](https://stackoverflow.com/questions/35030154/how-to-get-admin-privilege-in-cmd-for-running-sc-exe). – michael_heath Aug 01 '18 at 05:24