Batch file to execute a series of programs

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Hi,

Sorry for what is probably a very basic question...

I have a series of windows/applications that I usually want started after
machine reboot. However, there are occasions where I don't want these
applications to start.

Right now I've got a bunch of shortcuts in my Startup folder. I want to
replace these shortcuts with a batch file, which I will manually execute
after reboot. A couple requirements: 1) I don't want a command window
flashing up for each application, and 2) the batch file needs to not hang
when it executes an application that displays a window.

With Unix I would just put an ampersand & at the end of each invocation, and
it would start as a background process. Is there anything similar in
Windows?

What is the best approach? batch/cmd file? cscript? something else?

In summary, if you could post a file that invokes say calculator, notepad,
and paint, all without flashing a command window, that would be perfect.

Much appreciated,
Scott
 
Scott said:
and paint, all without flashing a command window, that would be perfect.

Rather than using a batch file I recommend using a VBScript. For example, copy and
paste the following 7 lines into notepad, save it with the extension .vbs, and then
double-click it to run it.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 1000
WshShell.Run "notepad"
WScript.Sleep 1000
WshShell.Run "mspaint"
Set WSHShell = Nothing

For more information about "Windows Script Host" search the Help and Support Center
for the topic.
 
Here's the *.bat file way if you're interested

start "" calc.exe
start "" notepad.exe
start /min "" mspaint.exe

Wth a batch file you can use /min or /max to change how each program
starts. You can create a shortcut to the batch file and in the shortcut's
properties change the batfile to run minimized, so it just very briefly
flashes on the taskbar.
If you go with the script way, be aware that if you use NAV script blocking
or something similar, it may trigger the script as possibly malicious,
because it executes programs.
 
Back
Top