-
April 26th, 2018, 11:31 PM
#1
Task Scheduler not running bat files
I have had several bat files that used to run at certain times throughout the day, but despite the status showing as Ready, they don't run anymore. If I right click and tell it to run, nothing happens. If I run the file manually, they work fine.
The script is using wscript.exe
Arguments: C:\xcopy backups\Batch files\Scripts\BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_CR.bat"
Start in: C:\xcopy backups\Batch files\
Any suggestions?
KZ
-
April 27th, 2018, 01:48 PM
#2
What version of Windows are you using?
Is the Task Scheduler Service running?
-
April 27th, 2018, 02:13 PM
#3
Windows 7 Home Premium SP1
Yes, the scheduler is running.
-
April 27th, 2018, 02:59 PM
#4
It's better to NOT use spaces in folder names. I'd at least use underscores. xcopy_backups vs. xcopy backups.
Try adding double quotes around all paths.
Arguments: "C:\xcopy backups\Batch files\Scripts\BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_CR.bat"
Start in: "C:\xcopy backups\Batch files\"
-
April 27th, 2018, 03:31 PM
#5
Thank you! I'll work on that and see how that goes!
BTW, I'll be out for a few days, so if I don't respond, I haven't forgotten....
-
May 1st, 2018, 09:35 PM
#6
It still does not work. Any other suggestions?
-
May 1st, 2018, 10:07 PM
#7
So the job was working in Task Scheduler, and then it just stopped working?
If I run the file manually, they work fine.
How exactly are you running these files manually? Are you opening a command prompt and running
wscript.exe C:\xcopy backups\Batch files\Scripts\BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_CR.bat"
What path are you using to wscript.exe? It should be in C:\Windows\System32
-
May 1st, 2018, 10:43 PM
#8
Yes, it had been working, but stopped some time ago.
I can run them manually from my batch file folder by just double-clicking on them.
I'm using wscript. I'm not sure where it's pointing to because that is the only text that is in the exe path. Do you think I need to re-setup the exe path?
All the directories now have complete folder and file names without spaces, but that didn't change anything...although a good idea.
-
May 2nd, 2018, 04:16 AM
#9
I can run them manually from my batch file folder by just double-clicking on them.
That's not the same thing. You're not running the same full command path.
Did you set up the task scheduler job? Unless you set the path variable, you need to set the full path of the .exe.
-
May 2nd, 2018, 09:15 PM
#10
Is this file required in the "Add arguments" section?
"C:\xcopy_backups\Batch_files\Scripts\BatchLauncher.vbs"
I did notice this evening that several of the scripts show "The system cannot find the path specified" and "The directory name mis invalid." Not sure what's up with that. Wondering if it's the vbs file. In the arguments section I have the BatchLauncher followed by the bat file name.
-
May 2nd, 2018, 09:36 PM
#11
Is this file required in the "Add arguments" section?
"C:\xcopy_backups\Batch_files\Scripts\BatchLauncher.vbs"
Didn't you write those scripts? What are you trying to do exactly?
That's why I asked if you tested the command from a command prompt. If it doesn't work there, it probably won't work in Task Scheduler.
Normally, you'd use wscript.exe to run one script. I'm not sure how your .vbs works with the .bat file.
-
May 2nd, 2018, 11:17 PM
#12
Yes, I did write those bat scripts. They work perfectly from a command prompt.
Someone on this forum a long time ago had me put that vbs in there. I'll have to research that.
-
August 20th, 2018, 05:05 PM
#13
Hi all. I'm finally getting back to this incomplete task....
My batch files run perfectly from a cmd prompt or by double-clicking them.
I have the Action Program/script set to "C:\Windows\System32\wscript.exe" and the Add aurguments to "C:\xcopy_backups\Batch_files\Copy_CR_to_NES.bat"
When I right-click on it to tell it to Run, I get an error popup that says "There is no script engine for file extension '.bat".
What am I doing wrong?
-
August 20th, 2018, 05:19 PM
#14
It's hard to remember when you don't post back for 3 months.
I found this error about cscript, but I'm assuming it's similar for wscript:
https://social.technet.microsoft.com...=winservercore
Regarding this error message, well, this is expected behavior as I noticed that you put both 'cscript' and '.bat' in this command. Cscript.exe does not work with '.bat' files, it supports VBScript (.vbs) and Jscript (.js). Please take a look at the following article for some general information:
http://technet.microsoft.com/en-us/l.../bb490887.aspx
So, as a workaround, you can either remove the 'cscript' character or, change the batch file to VBScript.
I don't really know VBScript, so someone else would need to help you with that.
-
August 20th, 2018, 05:25 PM
#15
wscript.exe / VBScript is not needed to run a .bat batch file.
Possibly useful Link:
https://www.thewindowsclub.com/how-t...ally-windows-7
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|