.bat file commands not executing all the sudden. No error messages.

JimmySteve

New member
Local time
11:22 PM
Messages
1
For over a year I had been using Windows Task Manager to open a
Code:
.bat
file on a schedule everyday. This has worked both in Windows 7 Pro & Windows 10 Pro when I updated. I have recently restored my PC back to Windows 7 Pro with nothing added to it but a couple RDPs, Microsoft Office & some network drives.

Please keep in mind, I know very little about
Code:
.bat
and
Code:
cmd
coding.

This
Code:
.bat
file was extremely simple. It called 8 different
Code:
.xlsm
Excel files that had auto macros loaded in them. It worked perfectly for over a year using the following commands in the
Code:
.bat
file to open the
Code:
.xlsm
files ...

Code:
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet1.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet2.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet3.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet4.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet5.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet6.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet7.xlsm
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHSet8.xlsm

The commands were working in such a fashion ...

1. First
Code:
.xlsm
file would open
2. Auto macros would run
3. Excel application would close via VBA script in the auto macros
4. Repeat until no more commands &
Code:
cmd
would close along with Excel @ end of last command

I recently edited some of the VBA code in a couple of these
Code:
.xlsm
files. I should also note that I accessed my PC using RDP around the same time (which I don't normally do), that I have administrative privileges and UAC is turned off.

My Issue

All of the sudden the
Code:
.bat
file will get stuck and not execute one of any of the commands (it's random). It will go smoothly through opening let's say 5 files and when it's time to open the 6th, it will simply not show the code in the
Code:
cmd
. It just sits there on the 5th command (which has already been completed ...

The issue is not with Excel or Task Scheduler. It is with the code not executing in the cmd. It just stops at random and does not execute the next command to open the next file.

I have tried the following variations of code to open these files but I am continuing to get the same issue ...

Code:
@Echo
C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram
IorpiaSCHSet1.xlsm

Code:
"C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHProgramSet1.xlsm"

Code:
Start /Wait cmd /k "C:\Users\JimmySteve\Documents\Macros\IorpiaSCHProgram\IorpiaSCHProgramSet1.xlsm && exit"

There are others that I am not recalling and nothing seems to make a difference.

To make things even more frustrating ... I have witnessed the
Code:
.bat
file completing successfully when scheduling a couple minutes away from my editing. It also does not seem to matter if I run manually.
 

My Computer My Computer

At a glance

Windows 7 Professional3.4 GHz8.00 GB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Optiplex 7040 Mini Tower
OS
Windows 7 Professional
CPU
3.4 GHz
Memory
8.00 GB
Hard Drives
Samsung 850 SSD 250 GB
Hi JimmySteve,

Did you create the batch file?

Do you know how to edit it? right-click file, choose edit, to open it in Notepad and view contents.

Have you tried replacing the .bat file with another with the same commands. Sometimes an executable, which a batch file is, gets corrupted. Either it won't run at all or partially runs and then hangs because of either a dropped bit or a flipped bit.

I wouldn't try to copy and paste the text into another open Notepad file as you most likely will copy the error causing text to the new file. I'd retype the first line and then copy paste it for the additional lines, then chang the numbers at the end of "Set" to match your original.

You can create a batch file in Notepad. When you save it, you have to change the save as type to all then add the .bat to the end of the filename. Notepad default it .txt, a text file.

Have you tried replacing the .bat file with another with the same commands. Sometimes an executable, which a batch file is, gets corrupted. Either it won't run at all or partially runs and then hangs because of either a dropped bit or a flipped bit.
 

My Computer My Computer

At a glance

Win 10 x64, Linux Lite, Win 7 x64, BlackArch,...
Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN
Back
Top