Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run a batch file in background?

Status
Not open for further replies.

grofaty

IS-IT--Management
Jan 16, 2003
370
SI
Hi,

I would like to run a batch file in background every 10 minutes. I know I can use a scheduled tasks to run a batch file, but how to run in in background - without batch window to appear?

Thanks,
Grofaty
 
You could try using "CS" a tool in the WIndows Resource kit. It will make any executable (so probably will work on a batch script) a service, which can be started, stopped, and set to run automatically when you boot... like a service, in fact! :)

Haven't tried it with a batch script, but I have been led to believe it would work. Give it a try...

First install rktools from microsoft, then look for reference to CS in the documentation, or type "CS /?" at the command prompt for instructions on usage.

Of course even if it does work that way, you may still get the annoying command window popping up... I'd be interested to know how you get on with it! :)

Will
[morning]
 
If you're doing it through scheduled tasks why not just set your task scheduler service to log on as the local system account under task scheduler properties on the logon tab and make sure that "allow service to interact with desktop" is NOT checked?

Cheers.
 
WillShakespeare,
thanks, but I don't like to install a new software on this computer.

cmeagan656, can you be more specific, how to select "system account" and where to disable seting "allow service to interact with desktop".

Thanks,
Grofaty
 
1. Right click on "my computer"
2. Select manage from the list that appears
3. Under "services and applications" hilight services
4. From the list of services highlight "task scheduler"
5. Right click on task scheduler and select "properties"
6. On the "log on" tab, select "local system account" as the account to log on as
7. Immmediately below the "local system account" line is an option to "allow service to interact with desktop". Make sure that this is NOT checked.

Cheers.
 
To set up the task that you want to run go to "scheduled tasks" in control panel and add the task in there using the wizard.

Cheers.
 
No probs! Good luck!
We install the Resource Kit as standard build on Servers here, as there are lots of very useful tools, so I often figure others do as well.

In fact, as far as I know you don't have to install anything for the tools, you just need to extract which ones you want and copy to a directory on the server.

Hope you find a solution! :)

Will
 
You could probably achieve the same using a VBS script and they run completely hidden.
 
I don't know. I've never used a VBS script for it. I tend to go route that takes the least time.

For security purposes, the server should be locked down so that only admins have access to the scheduled task folder and the services (inlcuding task scheduler) so if you're worried about access or someone changing it there shouldn't be a problem. I run various tasks during the day and noone ever knows their running. Sometimes I even forget until I get an email containing the log file, or whatever else is produced, for whatever task I've run.

Cheers.
 
Thank to you all for your help.

cmeagan656, I did exacly what you written down. But the window still pops-up.

What to do to disable this window pop-ups?

Thanks,
Grofaty
 
If you don't have the option to "allow service to interact with desktop" checked then I'm sorry, I don't know what else to suggest. I've never had a problem running it as a service. I can log on and off the server at will while the task is running without even knowing its running.

You are running the bat file through an AT command that you created through the scheduled task wizard, aren't you? You need to "call" the bat file using the AT command.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top