Background Batch File
I want to run a batch file via Scheduled Tasks in Windows XP.
Does anyone know how to run it in the background (without the window)? I don’t want to see the window. Just have it do it’s magic.
Crontab like (no crontab ports though, don’t want to add more software).
Anyone with info on how-to, please comment or email. Neat trick in the next 24-48 hours that involves this (will post of course).






October 29th, 2003 at 2:15 am
One option is the AT command.
October 29th, 2003 at 2:18 am
First, I don’t have WinXP.
Second, this isn’t really in the background.
Create a shortcut, and set the “Run” field for the shortcut to “Minimized’.
You might also go to the “Layout” tab and set the window size to 1×1 or something.
November 3rd, 2003 at 4:18 pm
Minimized is what I tend to use and the layout trick is handy. Could you set it up to run as a service using the resource kits to make the batch file a service? Not tried this personally but it might work.
March 19th, 2004 at 6:41 pm
Still trying to do what Robert asked about. Need to run a batch file minimized from Scheduler. Tried to run a shortcut to the batch file. It runs the batch file without the shortcut attributes (run minimized). What about PIF files in XP?
July 7th, 2004 at 12:31 pm
Using VB.net
November 18th, 2004 at 7:19 pm
I got it to work. Simply create a shortcut to the bat file in the same directory which will create a .lnk file. Go to the properties of the lnk file and set it to run minimized. Then, go to the scheduled task and “manually” enter the path+file name of the .lnk file.
If you click browse to search for the lnk file, it won’t work.
Then run the task and all you will see is a little flash or minimized icon on your taskbar while the bat does its thing.
Email me if you need help on this. henryparra@email.com
January 5th, 2005 at 2:00 pm
You can do this without creating a shortcut. Simply set up a scheduled task and set the field “Run as:” to “NT AUTHORITY\SYSTEM” (no quotes).
I have setup a simple .bat file in XP, (all it does is populates a txt file with the time it ran), put the path of the file in the Run: text box, then set the Run as: = NT AUTHORITY\SYSTEM , then set it to run every minute. The window that use to come up doesn’t anymore.
The way i figured it out was by setting up a scheduled task using the command line.
c:\at 13:30 “c:\time.bat” ^c:\output.txt
Doing this basically created a scheduled task in Task Scheduler to run time.bat at 1:30pm. When i went to task scheduler, it had a task called AT# (when you set up the task through the command-line, it tells you that it added a new job with job ID = #, where # is some number.
^c:\output.txt tells it to output to a text file called output.txt. (i don’t know how to actually set this output file when setting up a task through the GUI)
If you click on the Task AT# in task scheduler and look at the Run as: textbox, you should see a value that you should be able to use to run this task without the window showing up.
January 5th, 2005 at 2:04 pm
argggg…..it took out my slashes
c:\at 13:30 “c:\time.bat� ^c:\output.txt
February 10th, 2005 at 12:44 pm
I created a batch file called start.bat with a link to the batch file that i want to run in the background….heres how i did it.
First the start.bat file
then my actual bach file kept at e:\copy.bat
This worked for me when our Prof wouldnt share her ppts which she brought in her floppy disk ….all the best
April 17th, 2005 at 1:36 pm
Darell had the right idea, but the slashes were removed from the username: It’s:
NT AUTHORITY\SYSTEM
not
NT AUTHORITYSYSTEM
(backslash between the authority and system)
April 17th, 2005 at 1:37 pm
Argh, it removed the backslash again!
NT AUTHORITY\SYSTEM
July 5th, 2005 at 5:46 am
I created a simple batch file to copy important files from my HDD to a DVD-RW by creating a shortcut with the following inserted into the Target box. Set to minimized and off you go. Just add the shortcut to the Task Sheduler and set the frequency to do the task C:\WINDOWS\system32\xcopy.exe “G:\*.*” “E:\dailybackup” /D/R/H/V/E/Y
You need to setup the target folder on the DVD before you start
OS WINXP Pro
August 9th, 2005 at 4:41 am
I just did this, i created a new account in windows called test.. Set the schedule to run as test..
Then unchecking at the buttom Run only if logged on..
Then the batch rund as a diffrent user u will never see it POP up
August 22nd, 2005 at 10:17 am
To execute remote scripts or download output at different times and intervals you can use VisualCron -> http://www.visualcron.com
November 4th, 2005 at 6:48 pm
do any body know how to write the batch file to copy file one system to though out end user computer on the network to winnt\system32 folder please help thanks
January 19th, 2006 at 4:45 am
Try this
cmd /c start /min cmd /c
e.g.
cmd /c start /min cmd /c test.bat
January 19th, 2006 at 4:31 pm
I created a batch file that works perfect when run manually, but place it as a schedualed task in 2003 and it runs but does not copy the files. can you asisst?
January 23rd, 2006 at 3:20 pm
Thanks Darrell, for the “NT AUTHORITY\SYSTEM” info!
March 21st, 2006 at 7:11 pm
I made this lil batch file awhile ago. its opens up difrent every time. its kinda cool you can modify it. it dost have to do with anything here tho.
March 22nd, 2006 at 10:15 pm
running a batch through schedule task but use different ID(not just NT authority, password=??) will make the batch running on background. Tested and confirmed, cool trick, thanks..
April 27th, 2006 at 6:52 pm
If anyone is interested in Running a program or batch file every few minutes:
http://www.microsoft.com/resou.....x?mfr=true
May 25th, 2006 at 1:53 am
Thanks alot for your help to resolve my problem for same..
August 3rd, 2006 at 4:46 am
I tried this several times but discoverd that this only works for XP “NT AUTHORITY\SYSTEM”. I have machine here on nt2000 and winxp, created scheduled task for both uder users login. They both run ok, then I changed both to to use run as = NT AUTHORITY\SYSTEM with blank passwords.
It then runs task in background on XP machine but not on win2000 machine. Anybody else get this prob or know how to fix.
August 4th, 2006 at 5:35 am
Keep trying Tom, NT AUTHORITY\SYSTEM does the trick for me on Windows 2000 Professional
September 25th, 2006 at 11:38 am
Well the idea of using another win user was perfect for me, ’cause i work in a domain….thanks very much.
But…is it possible that there isn’t any option in batch files to make it run on background??
September 26th, 2006 at 9:38 pm
I need a batch file to create a desktop shortcut for users. The .exe that it needs to execute os on a shared drive on the server. The user will have a batch file map the drive but I need a script to map the shortcut to the exe on the server.
any ideas?
November 2nd, 2006 at 1:21 am
Assuming the app is installed in the same location for all machines, manually create the shortcut on one workstation. Create a folder in netlogon of a domain controller called desktop. Put the shortcut in that folder. In the domain logon script, include
xcopy \\servername\netlogon\desktop\*.* “c:\documents and settings\”%username%\desktop\ /d /y
Or something like that…I just typed it from memory
It will drop the file on their desktop when they log in. If they delete it, then it gets put back next time they log in. Once they have it, /d verifies they have the most current version… If you need to change it, just change the on int your netlogon\desktop folder. Deleting it required delete, but the pash is simmilar.
Of course the “correct” microsoft way is using group policy.
July 19th, 2007 at 2:55 am
private void regPROCESS()
{
ProcessStartInfo pinfo = new ProcessStartInfo(”regservice.bat”);
pinfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(pinfo);
}
July 28th, 2007 at 1:18 pm
FYI: I converted a few of the code samples in the comments to use syntax highlighting as necessary.
September 18th, 2007 at 1:30 am
As to getting the batch file to run seamlessly in the background,I think “Henry Says:November 18th, 2004 at 7:19 pm” had the easiest solution:you just have to ensure the Scheduler is being pointed to the ‘lnk’ file and not the bat file itself.If the batch file is ‘c:\copy.bat’ then you have to manually direct Scheduler to ‘c:\shortcut to copy.bat.lnk’.
Thanks Henry.
November 9th, 2007 at 2:19 pm
Hey I need a Batch File that will pick up user input and export the input when the user logs off in the form of a text file.
How might I go about doing this as I need the Batch File to run invisibly but still pick up user input.
If anybody knows how I might go about doing this please help, thanks.
November 15th, 2007 at 7:06 am
1st.
Why not use Group Policy in Windows XP? (gpedit.msc) and add a script to “logon”. This runs silently IIRC.
2nd.
Potter - You seem to be after a key logger. I think there is some legal issues with that, plus who knows if you are up to no good? You might be after bank logins and all sorts. Not at all good. I shall not help.
March 2nd, 2008 at 10:28 pm
How does the NT AUTHORITY\SYSTEM work?
April 3rd, 2008 at 8:09 pm
April 22nd, 2008 at 5:25 am
Hy i want to make a bach file that will run automatically whenever any one try to open the folder in which the batch file is placed. any help plz i need it. I just want to know whether it is possible or not.
Thanks.