Invoke EXE from batch file *without* waiting - batch-file

How do I invoke an EXE from a batch file without having the latter waiting for the EXE to finish? Something like the Cygwin 'cygstart'?

Use "start". Type "start /?" at a command prompt.

put START /B before the command you want to run

Just start foo.exe? You need to add /WAIT to make it pause.

Related

How run batch script to get output in text file

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

/stext command not working in Windows 10

I have a bat called launch.bat and ChromePass.exe in the same folder.
The bat:
chromepass.exe /stext output.txt
When executed, all it does is open the program in a new window and does not create the text file.
How can I make it so the program runs silently and actually outputs the text file?
This is because the developer (nirsoft.net) has removed the command-line options from the official releases as they were usually used by viruses to steal passwords from users without them knowing.
Original blog-post: http://blog.nirsoft.net/2014/09/22/command-line-options-removed-from-the-official-release-of-my-password-recovery-tools/
call ".\chromepass.exe" /stext .\output.txt
or
.\chromepass.exe /stext .\output.txt
Try one of those in command prompt.
try this /stext "readme.txt" it works perfectly on my windows 10
I hope when this code has run, you can get the solution of this problem
#echo off
start WireView.exe /stext WireView.txt
or
#echo off
start WireView.exe > WireView.txt

Executing bat files one by one

What I got is a list of bat files:
file1.bat
file2.bat
…
file29.bat
I need them to run one after each other. Meaning when the file1.bat closes file2.bat starts and so on.
I tried this, but it doesn't work properly:
start /wait call file1.bat
start /wait call file2.bat
You might want to add more to your question to make it easier to understand. My guess is that you want the bat file to open the next one then close itself after that.
If that's what you want to do; add these commands to each of the files:
start file2.bat
exit
Of course, you'll want to change start file2.bat to start file3.bat and so on for each file.
If you want file1.bat to manage all of the files, I don't think that's possible in batch.
You didn't describe how exactly it's not doing what you expected. I'm guessing that what happens is you're having to shut down each script before the next one will continue.
Documentation on start says:
WAIT Start application and wait for it to terminate.
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.
If you must use start then you could force it to use the /c switch which will automatically close the window once it's done:
start /wait cmd /c call file1.bat
I'm not really sure you accomplish anything by using call so that ought to be equivalent to just:
start /wait cmd /c file1.bat
Using start creates a new window for each program and you may just want to have it all run in a single command processor window.
As noted by Biffin you can just list them all out in a master script and they will run in order.
call file1.bat
call file2.bat
...
call file29.bat
And a shorthand for that is:
for /l %%f in (1; 1; 29) do call file%%f.bat
Remember to double up those percent characters inside a batch script but not on the command line.
This question might explain some of the unexpected behavior you were seeing.
How to run multiple .BAT files within a .BAT file

batch file START command without /WAIT

I need to start an exe from a batch file and after it has run it, I want the CMD prompt to exit, without waiting for the application to exit.
By just entering the location of the EXE does not work, it seems to wait for it to exit.
Is there a way to not do that with the START command?
Use CALL instead of START
call notepad.exe
echo byby
exit

Run a batch file in a new window from batch?

I know it seems this has been asked before, but I need a batch to open another batch in a new window. I've tried:
start abc.bat
cmd abc.bat
run abc.bat
and others. They've all opened in the same window or just opened Command Prompt in new window, ignoring my batch. Is there a batch command to open a batch file in a new window?
Is this what your after?
start "New Window" cmd /c test.cmd
It's a little bit strange that start abc.bat doesn't work but I assume this is because you are running this in the middle of another batch. You probably need call:
22:22:38.85 c:\help call
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
Giving you start call abc.bat or call start abc.bat depending on what the exact problem is.
To simply do it is just
start cmd /c "exampleexample.bat"
This could also work with spaces;
start cmd /c "example example.bat"
And directories.
start cmd /c "C:\NAME\Example\Hi there\example example.bat"
I created my universal batch with this and this works flawlessly.
start abc.bat works for me. What is the problem in your case? You could also try start cmd /c abc.bat.
I found something that works:
call "C:\FILEPATH HERE\abc"
Demo:
#echo off
call "C:\Users\USERNAME HERE\Desktop\abc"
This should work <3
Unfortunatly, I know of no such method (I encounter the same thing). However, try killing the old window when you start the batch
abc.bat:
abd.bat
stop
abd.bat:
#echo off
#echo It works!
If you are going to run it in a different command prompt, type start C:\abc.bat or whatever the directory of abc.bat is, or if you want to open it in the same command prompt, type call "C:\abc.bat" again, wherever the directory is. It should work
Either:
call "C:\abc.bat"
or
start C:\abc.bat

Resources