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).
48 replies on “Background Batch File”
One option is the AT command.
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.
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.
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?
Using VB.net
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
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.
argggg…..it took out my slashes
c:\at 13:30 “c:\time.bat? ^c:\output.txt
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
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)
Argh, it removed the backslash again!
NT AUTHORITY\SYSTEM
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
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 😉
To execute remote scripts or download output at different times and intervals you can use VisualCron -> http://www.visualcron.com
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 🙁
Try this
cmd /c start /min cmd /c
e.g.
cmd /c start /min cmd /c test.bat
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?
Thanks Darrell, for the “NT AUTHORITY\SYSTEM” info!
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.
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..
If anyone is interested in Running a program or batch file every few minutes:
http://www.microsoft.com/resou.....x?mfr=true
Thanks alot for your help to resolve my problem for same..
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.
Keep trying Tom, NT AUTHORITY\SYSTEM does the trick for me on Windows 2000 Professional
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??
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?
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.
FYI: I converted a few of the code samples in the comments to use syntax highlighting as necessary.
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.
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.
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.
How does the NT AUTHORITY\SYSTEM work?
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.
Or YOU can do this
Arka,
I think Your Question Is Possible.
I AM pretty Sure Of It.
I Will Do A Little Messing Arround For A Minute.
And If I Can Get It To Work I Will Show You How. 🙂
Give Me An hour Or So.
Thanks
Arka,
# Arka Says:
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.
I Did Some Testing With your Question. It May Be Possible But If So It IS to hard For Me To Do. 🙂
# Camn Ron Says:
July 29th, 2008 at 3:34 pm
# Camn Ron Says:
July 29th, 2008 at 3:35 pm
Or YOU can do this
I Think Those Will Only Work If YOU have Window Media Player 9
or higher
if they dont work try deleting the
“start wmplayer /play”
and just leave it as
“@echo “%%windir%%\system32\oobe\images\title.wma�? >> ya1.ba”
Thanks
i think you all suck at making these batch file “viruses” mabey you should go on youtube and watch some videos…
so how do I make a .cmd file run without the window?
To schedule a task without ever seeing a window or any changes in screen, I use biterscripting ( for free installation). It is a better alternative to DOS Commands. You write a script for what you want to accomplish, then schedule the following task using task scheduler.
biterscripting.exe script_file
The above will execute the script every day, every hour, etc based on your settings. And, you will never see a window.
Richard
NT AUTHORITY\SYSTEM
Quite a trick. It works fine with me, for XP. Invisible. Thank you very much.
I think the best way is to compile the batch file you want to run in background mode to EXE with help of Dr.Batcher ( http://www.drbatcher.com ). You can choose ‘invisible’ mode of running your script, and it will run without showing console window.
I used a VBS file to make my batch file run in the backround:
Here’s the VBS file:
hope this helps.
For the original post, you can do this to minimize cmd shell:
start /min application.exe
It runs application.exe and minimize cmd shell
(thanks for fredi for initial idea)
Hy i want to make a bach file that will run automatically after copying the batch in C: and boots the windows, any help plz i need it.