Kitz Forum
Computer Software => Windows => Topic started by: Bald_Eagle1 on November 20, 2011, 12:23:38 AM
-
Hi All,
Do any of you know how to run a batch file silently via Windows Scheduler.
I currently have a batch file running every 2 minutes & would like to run it every minute (or even more frequently if possible).
The problem is that it pops up a CMD window for a second or two each time it runs.
Once every 2 minutes is just about tolerable, but every minute would be a real P.I.T.A.
This is very annoying when working at the PC & I would like it to run minimised, or completely hidden.
Do any of you know of a way to do this?
Batch files cannot be set to run minimised, but a shortcut to one can (normally).
This trick doesn't seem to work when using Scheduler though, unless I am just missing an obvious setting somewhere.
I would like to enable this feature for XP, Vista, & Windows 7 machines.
Paul.
-
Does Section 6 here help you ?
http://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window
-
Does Section 6 here help you ?
http://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window
Hi tuftedduck,
I think I have tried every combination of the various suggestions in that link.
With some, the batch file (and/or its shortcut) didn't run at all & with the others it ran, but still popped up the annoying CMD window.
I have only got this to work via various BAT to EXE converters, using very simple batch files.
However, as I want to pass the batch file around, with the ability to edit it as necessary, this doesn't seem a good option.
Also, all the "free" BAT to EXE converters I have tried do not allow the resulting EXE to run on anyone else's PC.
I also believe the BAT to EXE converters struggle with environment variable that are set in a batch file & are often classed as a virus by many/most AV programs.
I'll keep looking for a method to resolve this, but any other suggestions would be most welcome.
Paul.
-
Hi,
I have found a scheduler for Windows that works perfectly sliently (z-cron), apart from the maximum frequency for tasks being 5 minutes rather than the 1 minute I require.
I have emailed their support team to see if this frequency can be adjusted at all, but it might be back to the drawing board :(
Paul.
-
I have found a scheduler for Windows that works perfectly sliently (z-cron), apart from the maximum frequency for tasks being 5 minutes rather than the 1 minute I require.
Quick update - success.
I have finally resolved this via Windows Scheduler itself.
The steps necessary are:-
1) Create the "real" batch file e.g. DOSOMETHING.BAT
2) Create another batch file that contains the single line "DOSOMETHING.BAT>nul" (no spaces) & name it something like "Run_DOSOMETHING.BAT". The >nul part forces it to not display any output, but it still pops up a black CMD window.
3) Create a shortcut to "RunDOSOMETING.BAT" that will be automatically named "Run_DOSOMETHING.BAT - Shortcut" & instruct it to run Minimized in its "Properties" tab.
That hides the pop up CMD window, but the task bar icons can still be seen expanding & contracting as the batch file(s) run.
4) Create a scheduled task to actually run the shortcut at whatever intervals are required, but in the "Action" section enter the program as "Run_DOSOMETHING.BAT - Shortcut.lnk"
The addition of ".lnk" is necessary, otherwise the normal .BAT file will run.
If asked if you want to run the task with arguments, choose NO.
5) Choose to run the task "whether user is logged on or not", also entering your usual Windows logon password (if requested).
Job done.
The above certainly works for Windows 7, & I imagine a similar procedure will work for previous Windows versions too.
Absolutely no sign of the batch file(s) running can be seen, apart from the dates/times of the files being created/updated as output from the batch file(s) auto-updating. Even this is only visible if actually viewing the relevant folder at the time.
The scheduled task now runs as a Windows "Service" thus there is no danger of accidentally stopping it.
Paul.
-
Congratulations for your success. :clap: :dance:
I must say it is a very convoluted rigmarole . . . :-X
A simpler solution would be to throw out that computer infested with the Redmond Company's Virus (a.k.a. Windoze) :comp: and use one which has a proper operating system installed! :thumbs:
-
A simpler solution would be to throw out that computer infested with the Redmond Company's Virus (a.k.a. Windoze) :comp: and use one which has a proper operating system installed! :thumbs:
Ah, but wouldn't life be so boring without all these little interesting things sent to try us? ;)
-
What you need,perhaps, is pycron - http://www.kalab.com/freeware/pycron/pycron.htm
It brings the Linux/Unix cron facilities to Windows. Seems it can run every minute, just like the "real" cron.
Cheers,
Peter
-
Cheers geep,
I might give that a go at some time, but I'm reasonably happy now that I have got Windows Task Scheduler to do just what I needed for the specific purpose of harvesting my FTTC modem's stats 24/7.
Paul.
-
Anyone seen Mary recently?
Perhaps she would like to post to this thread?
Having made that observation, b*cat now goes to hide . . . :)
-
Anyone seen Mary recently?
Perhaps she would like to post to this thread?
Having made that observation, b*cat now goes to hide . . . :)
Last time I saw her, she was leaving on a jet plane.
I'll get my coat now then.
-
For those who do not understand this cat - eagle interaction, look at the very last word in Messrs Geep & Eagle individual posts and then look at this Wikipedia link (http://en.wikipedia.org/wiki/Peter,_Paul_and_Mary). :P
-
I was wondering what it was about :-[