strCommand: String value indicating the command line you want to run. You must include any parameters you want to pass to the executable file.

intWindowStyle: Optional. Integer value indicating the appearance of the program's window. Note that not all programs make use of this information.

bWaitOnReturn: Optional. Boolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script. If set to true, script execution halts until the program finishes, and Run returns any error code returned by the program. If set to false (the default), the Run method returns immediately after starting the program, automatically returning 0 (not to be interpreted as an error code).

Are you running this as a scheduled task? If so set it to run as a different user account then it won't be visible to the logged on user. If the script needs no network access to items that need windows auth (like file shares or printers), you can run it as "nt authority\system" and leave the password blank. On Windows 7, just set the user to SYSTEM, and press OK.

(You probably have to use a real user though if you're using robocopy...)

Thanks - this was less hassle for me than the .vbs option.
–
mackenirFeb 10 '10 at 16:45

I like the idea, but I am the only user on this desktop, and its a work PC so cannot create others. When ever I select anything else in the "Run as" box, it asks for a password and confirmation, of which mine fails.
–
IanVaughanFeb 9 '11 at 15:19

5

I set the "Run as" user to SYSTEM (which it later changed o NT AUTHORITY\SYSTEM) and it worked for me. I no longer see the popup CMD window when my scheduled task runs. Thanks!
–
Ryan StilleMar 25 '11 at 17:28

1

+1, this is elegant. Be sure to enter "system" as the user name, then win7 does the rest for you. Note that you DO get network access to the internet, just not to network shares and things that need windows auth.
–
samsmithMar 2 '12 at 4:36

Both this and Rocketmonkeys suggestion involve downloading new tools, which means more compatibility over various peoples desktops. The baked in, using windows commands is much better.
–
IanVaughanFeb 9 '11 at 15:14

Plus cmdow is detected as "hazardous" by some anti-virus programs (it is not hazardous, but the detection can itself cause some problems if the cmdow file is quarantined...).
–
OtielDec 10 '12 at 15:36

there is still popup console, just flash very quick.
–
BambooJul 22 '14 at 10:37

This does not work, the Scheduled Task->Status states "Could not start", thats with : start /b C:\file.bat : and : start /b "C:\file.bat" : but : C:\file.bat : works just fine.
–
IanVaughanFeb 9 '11 at 15:12

You can create a shortcut to the batch file, set the shortcut to start minimized (in the shortcut's properties, 'Shortcut' tab), and then set the job to start the shortcut.

Important: You'll need to specify the path to the shortcut manually by typing it into the Run text field, complete with the '.lnk' extension; if you just try to browse to it, it will helpfully redirect itself to whatever the shortcut points to.