Link to home
Start Free TrialLog in
Avatar of hlking
hlking

asked on

Running bat file as scheduled task doesn't work in Vista

I am going crazy trying to sort out this issue.  I have a bat file that maps two network drives and then executes a vbs file (contents in code section).  It runs correctly from the command line but as a scheduled task it doesn't do anything.  Is say it completed successfully with code 0x0 but it didn't do what it was supposed to do.

I have "Run with highest privileges" checked.  I'm logged in as an administrator and I have the task scheduled to run with an administrator account.
net use H: \\wvdl1\wvdl-m\
net use Y: \\wvdl8\D$
cscript /nologo G:\BSEtoNAHLNonHK.vbs

Open in new window

5-14-2009-3-18-15-PM.jpg
Avatar of Stephen
Stephen
Flag of United States of America image

It shouldn't make any difference, but I don't have Vista so I can't test it, but did you try renaming the .BAT to a .CMD file and running it that way? Like I said, it may not fix your problem but it's worth a shot.

Are you sure it is actually running? Do you see it pop up when it's scheduled time arrives? Another good way to trouble shoot it to put 'pause' after each line in the code and then sit there when it runs to see if anything in the code is causing it to fail. If the batch simply starts Vista will tell you that the file ran. The task scheduler has no idea what the file contains and if the file errors out and fails it will close prematurely even though the task scheduler thinks it completed because it stopped.
ASKER CERTIFIED SOLUTION
Avatar of hlking
hlking

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok. No problem. Glad you got it working.