Solved Windows Task Scheduler Batch File

Shloma

New member
Local time
6:15 PM
Messages
6
Hello:

I have a Batch File, to move a file to a different folder, that I would like to run from Windows Task Scheduler on a windows server 2008 R2 . The batch file itself works, however running it from Windows Task Scheduler does not work. I am trying to move the file within the L drive.

I tried entering in Program/Script box: cmd
and in the add arguments: /c start "" "C:\Users\Administrator\Desktop\Test.bat"

But no luck. Any Idea why.

Thanks much!

Shloma
 

My Computer

Computer type
PC/Desktop
OS
New York
This is genuinely a wild guess and I could be entirely wrong but, could it be that the L drive hasn't entirely initialized yet on startup? Perhaps the script is being run too soon?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7
CPU
AMD Phenom II X4 955 Black Edition
Motherboard
MSI 870A-G54
Memory
8GB
Graphics Card(s)
PNY XLR8 GeForce GTX 460 1024MB GDDR5
Monitor(s) Displays
2 x 24"
The first line of the batch file is: L:
and on the 2th line I start the move statment. This should initialise the L drive. and it does work when runing the batch file.

Thanks YISMM!
 

My Computer

Computer type
PC/Desktop
OS
New York
The first line in the script does not initialize the drive. That simply tells the command prompt you want access to the L drive. Not the same thing. What I'm saying is, perhaps Windows hasn't attached the drive before the script is being initiated. Have you checked the Event Viewer to see if there are any errors? I'm assuming no errors are popping up on your screen either when the script is being initiated? Anyway, I'll let someone else chime in with more experience.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7
CPU
AMD Phenom II X4 955 Black Edition
Motherboard
MSI 870A-G54
Memory
8GB
Graphics Card(s)
PNY XLR8 GeForce GTX 460 1024MB GDDR5
Monitor(s) Displays
2 x 24"
In Task Scheduler click Enable All Tasks History in the right pane
Run the task
Look in the Task History tab and see if there are any error messages that might help
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
home built
OS
Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
CPU
AMD Athlon II x4 620
Motherboard
Gigabyte GA-MA785G-UD3H
Memory
6GB GSkill DDR2 800
Graphics Card(s)
AMD 4670 GPU + AMD 4200 IGP
Sound Card
on board Realtek ALC889A
Monitor(s) Displays
RCA 40" LCD TV, Insignia 32" LCD TV, HP 15" LCD monitor
Screen Resolution
1680 x 1050
Hard Drives
OCZ Vertex 3 120GB,
Samsung F3 1TB (3),
Several others - WD, Seagate, Hitachi, ...
PSU
Corsair 500 W
Case
Rosewill mid tower
Cooling
CM 90mm rifle
Keyboard
Gyration wireless, Logitech wireless, Dell USB wired
Mouse
Gyration wireless, Logitech wireless, V7 USB wired
Internet Speed
Spectrum - 100Mbps D / 10Mbps U
Antivirus
Avast, MBAM3, EMET, WinPatrol
Browser
Pale Moon, Firefox, IE
Other Info
2 multi-boot PC's
Mainly HTPC/Office/Gen purpose (no gaming).
Trendnet USB KVM.
LG DVD burner/Blue Ray Player.
Tray system for removable SATA backup drives.

Not currently OCd, under-volted.
I use Hybrid sleep, rarely re-boot or shutdown.

Hauppauge HD-PVR, Avermedia PCIe TV Tuner, Hauppauge PCI TV Tuner.
Try and add this new line as the first line in the batch file, so you can verify if it starts or not:
pause

If you suspect the cmd window isn't even started from task scheduler try and change cmd to c:\windows\system32\cmd.exe
You could also try without start ""
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
History shows Task Completed. Looks like batch file does not start, since nothing opens after I added the pause even with adding the path for cmd. Removing the start" " causes the task manager to continue running with no luck.

Thank you so much for all of your help and guidance, hope you will come up with the bug soon.

Shloma
 

My Computer

Computer type
PC/Desktop
OS
New York
I'm not sure i understand how you're trying to run the bat file ???

When i setup a scheduled task to run a bat file, i just run the bat file like this:

TaskSchedBat_01.png
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
home built
OS
Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
CPU
AMD Athlon II x4 620
Motherboard
Gigabyte GA-MA785G-UD3H
Memory
6GB GSkill DDR2 800
Graphics Card(s)
AMD 4670 GPU + AMD 4200 IGP
Sound Card
on board Realtek ALC889A
Monitor(s) Displays
RCA 40" LCD TV, Insignia 32" LCD TV, HP 15" LCD monitor
Screen Resolution
1680 x 1050
Hard Drives
OCZ Vertex 3 120GB,
Samsung F3 1TB (3),
Several others - WD, Seagate, Hitachi, ...
PSU
Corsair 500 W
Case
Rosewill mid tower
Cooling
CM 90mm rifle
Keyboard
Gyration wireless, Logitech wireless, Dell USB wired
Mouse
Gyration wireless, Logitech wireless, V7 USB wired
Internet Speed
Spectrum - 100Mbps D / 10Mbps U
Antivirus
Avast, MBAM3, EMET, WinPatrol
Browser
Pale Moon, Firefox, IE
Other Info
2 multi-boot PC's
Mainly HTPC/Office/Gen purpose (no gaming).
Trendnet USB KVM.
LG DVD burner/Blue Ray Player.
Tray system for removable SATA backup drives.

Not currently OCd, under-volted.
I use Hybrid sleep, rarely re-boot or shutdown.

Hauppauge HD-PVR, Avermedia PCIe TV Tuner, Hauppauge PCI TV Tuner.
This will not work, because the batch file will not run in cmd.
 

My Computer

Computer type
PC/Desktop
OS
New York

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
home built
OS
Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
CPU
AMD Athlon II x4 620
Motherboard
Gigabyte GA-MA785G-UD3H
Memory
6GB GSkill DDR2 800
Graphics Card(s)
AMD 4670 GPU + AMD 4200 IGP
Sound Card
on board Realtek ALC889A
Monitor(s) Displays
RCA 40" LCD TV, Insignia 32" LCD TV, HP 15" LCD monitor
Screen Resolution
1680 x 1050
Hard Drives
OCZ Vertex 3 120GB,
Samsung F3 1TB (3),
Several others - WD, Seagate, Hitachi, ...
PSU
Corsair 500 W
Case
Rosewill mid tower
Cooling
CM 90mm rifle
Keyboard
Gyration wireless, Logitech wireless, Dell USB wired
Mouse
Gyration wireless, Logitech wireless, V7 USB wired
Internet Speed
Spectrum - 100Mbps D / 10Mbps U
Antivirus
Avast, MBAM3, EMET, WinPatrol
Browser
Pale Moon, Firefox, IE
Other Info
2 multi-boot PC's
Mainly HTPC/Office/Gen purpose (no gaming).
Trendnet USB KVM.
LG DVD burner/Blue Ray Player.
Tray system for removable SATA backup drives.

Not currently OCd, under-volted.
I use Hybrid sleep, rarely re-boot or shutdown.

Hauppauge HD-PVR, Avermedia PCIe TV Tuner, Hauppauge PCI TV Tuner.
I just found the reason it was not working. My mistake. I used double quotes while designating the file & folder paths instead of single quotes, on the batch file itself. Therefore it was not running from windows task manager, however it did work from the batch file itself.

Thank you so much for all yourhelp David, Tookeri & nekkidtruth
All the best!

Shloma
 

My Computer

Computer type
PC/Desktop
OS
New York
Glad you got it sorted!
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7
CPU
AMD Phenom II X4 955 Black Edition
Motherboard
MSI 870A-G54
Memory
8GB
Graphics Card(s)
PNY XLR8 GeForce GTX 460 1024MB GDDR5
Monitor(s) Displays
2 x 24"
Back
Top