Solved

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

Posted on 2009-05-14
3
426 Views
Last Modified: 2012-05-07
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
0
Comment
Question by:hlking
  • 2
3 Comments
 
LVL 8

Expert Comment

by:sjl1986
Comment Utility
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.
0
 

Accepted Solution

by:
hlking earned 0 total points
Comment Utility
Argghh...the problem was the back slash at the end of my first NET USE command.  The reason it didn't fail when run from a command line is because I already had that drive letter mapped.  

Thanks for your ideas sjl1986.
0
 
LVL 8

Expert Comment

by:sjl1986
Comment Utility
Ok. No problem. Glad you got it working.
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

So who is this article for? If you are like most of the computer users out there, you probably only realize the meaning of 'System maintenance' after something goes wrong. This article is for you if you care about keeping your system working opti…
There are many reasons a PC runs slower than when it was new, ranging from malicious software intended to mess things up to simple general Windows use.  Your PC performance may slowly degrade over time without you noticing but when you buy a PC from…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now