Search code examples
windowsbatch-filecmd

How to start a batch file minimized with task scheduler in Windows 8? - %comspec% method not working anymore after Windows 7


After Windows XP, I always use the trick below to start batch files minimized with Windows Task Manager.

From http://www.pcreview.co.uk/forums/running-bat-files-minimized-scheduler-t2125918.html:

"prequisite: all your batch files have an exit-command to finish the actions off. If you do not exit, you will end with a command prompt blinking.

This is what I keep using:

%comspec% /c start /min "C:\Scripts\Destination_inbound_ftp5.bat"

When you save this in the properties, you will get a follow-up dialogue asking you if you meant all this to be parameters or not. Answer NO and the task will be saved as you would expect.

I also read the Stack Overflow question “start %comspec% /c script.cmd” vs “start cmd /C second.cmd script.cmd”, which made me replace the "%comspec%" statement with "C:\Windows\system32\cmd.exe", but that did not change anything either.

The problem is that now, instead of a minimized running bat file, I end up with just a command prompt, minimized but without any of the batch commands executed. The task scheduler status remains "running" :(

How do I get this done on Windows 8 (64-bit)? Preferrable with old-school batch commands instead of PowerShell (or worse ;p)


Solution

  • The start command needs the leading "" quotes to disable the title feature. Try scheduling this:

    %comspec% /c start "" /min "C:\Scripts\Destination_inbound_ftp5.bat"  ^& exit