Solved

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

Posted on 2009-05-14
3
434 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
ID: 24389414
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
ID: 24389673
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
ID: 24389829
Ok. No problem. Glad you got it working.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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