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
3
  • 1
    Try start usbinvoke.exe argument >> output.txt Commented Aug 1, 2018 at 4:02
  • @JohnKens i tried with ">>c:\result\output.txt" and "> c:\result\output.txt" but both give empty file not out put of usb invoke since its launching command line seperately. Commented Aug 1, 2018 at 4:35
  • 2
    If you dwant to stick to start, try with start "" /B ...... Commented Aug 1, 2018 at 8:57

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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).

1 Comment

You can shift rightclick and run as admin. Internally handled, try the answer How to get admin privilege in cmd for running sc.exe?.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.