Go Back   TechArena Community > Technical Support > Computer Help > Windows Security
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



Using Windows "scheduled tasks" to launch a .bat file

Windows Security


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-02-2008
Dave Calkins
 
Posts: n/a
Using Windows "scheduled tasks" to launch a .bat file

I have a .bat file which I'd like to have run automatically every night.

I tried using Windows "scheduled tasks" and referenced the .bat file. I then
tried manually running it to test it. A command window briefly flashes on
the screen but the .bat file does not appear to be invoked.

I verified that the .bat file isn't getting called by creating a simple test
..bat file which did nothing more than create a file on disk. Sure enough the
..bat file isn't getting called. The test .bat file contents are shown below.


echo hello >> c:\test_log.txt


I also tried referencing cmd.exe /c "c:\test.bat" in the scheduled task and
this didn't work either.

The annoying part about all this is that I successfully did this a long time
ago and I recall having similar issues and eventually figuring it out If
only I could recall what the magic was which made it work.

Any ideas?




Reply With Quote
  #2  
Old 19-02-2008
Dave Calkins
 
Posts: n/a
Re: Using Windows "scheduled tasks" to launch a .bat file

I found the problem. Someone else suggested using cmd.exe /k "the .bat
file" so that the window would stay open, allowing viewing of any errors.

As it turns out, the problem was caused by one of the directories in the
path to the .bat file containing spaces. Using dir /x to obtain the 8.3
abbreviated name and using that instead fixed the problem.


"Dave Calkins" <david.calkins@noemail.noemail> wrote in message
news:%23lSue1lcIHA.748@TK2MSFTNGP04.phx.gbl...
>I have a .bat file which I'd like to have run automatically every night.
>
> I tried using Windows "scheduled tasks" and referenced the .bat file. I
> then tried manually running it to test it. A command window briefly
> flashes on the screen but the .bat file does not appear to be invoked.
>
> I verified that the .bat file isn't getting called by creating a simple
> test .bat file which did nothing more than create a file on disk. Sure
> enough the .bat file isn't getting called. The test .bat file contents are
> shown below.
>
>
> echo hello >> c:\test_log.txt
>
>
> I also tried referencing cmd.exe /c "c:\test.bat" in the scheduled task
> and this didn't work either.
>
> The annoying part about all this is that I successfully did this a long
> time ago and I recall having similar issues and eventually figuring it out
> If only I could recall what the magic was which made it work.
>
> Any ideas?
>
>
>



Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Security


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Using Windows "scheduled tasks" to launch a .bat file"
Thread Thread Starter Forum Replies Last Post
Card reader error "Device can’t start code 10" "WPD file system volume driver" in windows 7 Musharat Operating Systems 4 12-02-2011 07:10 AM
Windows 2003 WSUS Clients Hanging at "Windows Is Shutting Down..." After Scheduled Patch Install and Auto-Reboot David in Kansas City Server Update Service 7 22-04-2010 09:24 AM
"Scheduled Tasks" share does NOT show up when browsing with UNC Yann Windows Server Help 1 26-11-2009 02:00 AM
"View Workgroup Computers" is missing from "Network Tasks" Helpless in Seattle Windows XP Support 1 29-11-2007 08:18 PM
Adding commands to "Folder Options/Edit File Type/Actions" grayed-out "Edit" & "Remove" Green_XP Windows XP Support 1 06-11-2007 02:18 PM


All times are GMT +5.5. The time now is 04:45 PM.