Run minimized batch file from scheduler

3

1

I added a batch file to the Windows 7 scheduler and it works fine. The problem is it always displays a command prompt window when it is run. I created a shortcut for the batch file and set it to run minimized in properties.

Then I went to the scheduled task and tried to change the action to run the shortcut instead of the original batch file. The problem is the scheduler resolves the shortcut immediately and puts the original batch file path to the action field. What should I do?

Tom

Posted 2010-01-30T21:13:32.377

Reputation: 1 841

Answers

5

You need to tell the batch file to run without a console.

This page has some instructions for writing a Windows Script:

Set Shell = CreateObject("WScript.Shell")
Shell.Run <Path to command or batch file>, 0, False

It also mentions a tool called hstart - which I haven't seen before, so you'd need to check it out.

This question on Stack Overflow has some other suggestions as well as full instructions for writing a vb script to wrap the code I posted above.

ChrisF

Posted 2010-01-30T21:13:32.377

Reputation: 39 650

Reference to run command: http://msdn.microsoft.com/en-us/library/d5fk67ky%28VS.85%29.aspx

– Brettski – 2010-08-29T06:54:16.707

Plus it seems the run method has problems with folder names with spaces – Brettski – 2010-08-29T07:06:23.683