Batch files Not Working


Donnje

Active member
Local time
1:30 AM
Posts
38
OS
W10
Hello everyone,
If I open any .bat file, the DOS opens and closes immediately, I tried disabling Windows antivirus, created an exception for that file but the problem remains, any ideas?
thanks
 

My Computer My Computer

At a glance

W10
OS
W10
Did you put a 'pause' command at the end of the file?
Otherwise the window will close immediately, that is default behaviour of batch files.

If it does not reach the pause command and does close the window anyway, somewhere there is an error in your coding.
In that case it will help to insert more than one pause command.
You may test the point where it stops by inserting this sequence:

echo pause 1
pause

and on the next 'stop':

echo pause 2
pause

etc.
 

My Computer My Computer

At a glance

Windows 11 Pro 25H2AMD Ryzen 7 5700GKingston FURY Beast 2x16GB DIMM DDR4 2666 CL16MSI GeForce GT 730 2GB LP V1
OS
Windows 11 Pro 25H2
Computer type
PC/Desktop
Manufacturer/Model
Build by vendor to my specs
CPU
AMD Ryzen 7 5700G
Motherboard
MSI PRO B550M-P Gen3
Memory
Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
Graphics Card(s)
MSI GeForce GT 730 2GB LP V1
Sound Card
Creative Sound Blaster Audigy FX
Monitor(s) Displays
Samsung S24E450F 24"
Screen Resolution
1920 x 1080
Hard Drives
1. SSD Crucial P5 Plus 500GB PCIe M.2
2. SSD-SATA Crucial MX500-2TB
PSU
Corsair CV650W
Case
Cooler Master Silencio S400
Cooling
Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
Keyboard
Cherry Stream (wired, scissor keys)
Mouse
Asus WT465 (wireless)
Internet Speed
70 Mbps down / 80 Mbps up
Browser
Firefox 130.0
Antivirus
F-Secure (Internetprovider version)
Other Info
Router: FRITZBox 7490
Oracle VirtualBox 7 for testing software on Win 10 or 11
the .bat launches another program in dos, on another pc it works
 

My Computer My Computer

At a glance

W10
OS
W10
How could we possibly determine what wrong with either your system, the batch or the dos program you launch, if we don't know anything about your system, the batch and the program you'r trying to start? Is the path to the dos program correctly written in the batch?

And: most important: would you like to post the commands in that batch, so that we can have a look at it?
If there are any personal data in it, you might replace them by xxxxx characters.

PS. The only thing we know about your system is that you are using OS: W10.

PS2. Of any batch that you want to attach to an answer here, you can change the extension from .bat into .txt. So no harm will be done to the system of the person that it viewing it. I even think it is not allowed to attach .bat files.
Edit: just did a test and indeed: attaching a file that is ending with .bat is not allowed.
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Pro 25H2AMD Ryzen 7 5700GKingston FURY Beast 2x16GB DIMM DDR4 2666 CL16MSI GeForce GT 730 2GB LP V1
OS
Windows 11 Pro 25H2
Computer type
PC/Desktop
Manufacturer/Model
Build by vendor to my specs
CPU
AMD Ryzen 7 5700G
Motherboard
MSI PRO B550M-P Gen3
Memory
Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
Graphics Card(s)
MSI GeForce GT 730 2GB LP V1
Sound Card
Creative Sound Blaster Audigy FX
Monitor(s) Displays
Samsung S24E450F 24"
Screen Resolution
1920 x 1080
Hard Drives
1. SSD Crucial P5 Plus 500GB PCIe M.2
2. SSD-SATA Crucial MX500-2TB
PSU
Corsair CV650W
Case
Cooler Master Silencio S400
Cooling
Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
Keyboard
Cherry Stream (wired, scissor keys)
Mouse
Asus WT465 (wireless)
Internet Speed
70 Mbps down / 80 Mbps up
Browser
Firefox 130.0
Antivirus
F-Secure (Internetprovider version)
Other Info
Router: FRITZBox 7490
Oracle VirtualBox 7 for testing software on Win 10 or 11
thank you all the same
 

My Computer My Computer

At a glance

W10
OS
W10
Open a command prompt and run the batch file from there. That way, the host won't close and you'll be able to see any errors and such.
 

My Computer My Computer

At a glance

Win11 Ent. 25H2
OS
Win11 Ent. 25H2
I tried but it doesn't give an error, it opens and closes the DOS
 

My Computer My Computer

At a glance

W10
OS
W10
As @Kees suggested, you need to edit the batch file(s) and insert pause commands.

But first, copy the batch file(s) so that you retain the original version(s) that you can revert and/or refer to at any time.

Now you can go ahead and start inserting the pauses. Moreover, there's probably an "@echo off" at the top of the file(s), so you might want to rem those out as you start troubleshooting.
 

My Computer My Computer

At a glance

Windows 11 Pro32GB
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Microsoft Surface Laptop Studio
Memory
32GB
Monitor(s) Displays
Three (3) Dell U3223QE
Screen Resolution
Surface: 2400x1600; Dells: 3840x2160
Hard Drives
1TB
sorry I made a mistake I noticed that the .bat file opens another program called TTInstall.Mini-20200829.exe and this is what then opens the DOS which does not process but closes
 

My Computer My Computer

At a glance

W10
OS
W10
So you solved your problem?
If yes, please mark the thread as solved.
 

My Computer My Computer

At a glance

Windows 11 Pro 25H2AMD Ryzen 7 5700GKingston FURY Beast 2x16GB DIMM DDR4 2666 CL16MSI GeForce GT 730 2GB LP V1
OS
Windows 11 Pro 25H2
Computer type
PC/Desktop
Manufacturer/Model
Build by vendor to my specs
CPU
AMD Ryzen 7 5700G
Motherboard
MSI PRO B550M-P Gen3
Memory
Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
Graphics Card(s)
MSI GeForce GT 730 2GB LP V1
Sound Card
Creative Sound Blaster Audigy FX
Monitor(s) Displays
Samsung S24E450F 24"
Screen Resolution
1920 x 1080
Hard Drives
1. SSD Crucial P5 Plus 500GB PCIe M.2
2. SSD-SATA Crucial MX500-2TB
PSU
Corsair CV650W
Case
Cooler Master Silencio S400
Cooling
Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
Keyboard
Cherry Stream (wired, scissor keys)
Mouse
Asus WT465 (wireless)
Internet Speed
70 Mbps down / 80 Mbps up
Browser
Firefox 130.0
Antivirus
F-Secure (Internetprovider version)
Other Info
Router: FRITZBox 7490
Oracle VirtualBox 7 for testing software on Win 10 or 11
no I haven't solved it but I can't attach .exe files
 

My Computer My Computer

At a glance

W10
OS
W10
If I open any .bat file, the DOS opens and closes immediately
it doesn't give an error
the .bat file
Which is it?
- Any bat file, or
- One particular bat file?

the .bat file opens another program called TTInstall.Mini-20200829.exe and this is what then opens the DOS
No. Unless you have used special techniques, a batch file opens the command window.
Assuming it is just one particular batch file in question, please post that batch file [just paste it as simple text within your next post].

I suggest you add Pause lines both before & after the command that calls up TTInstall.Mini-20200829.exe in order to confirm that
1 The command window opens, and
2 The TTInstall.Mini-20200829.exe command closes [crashes] the command window.
e.g.
Pause 1 This line is shown before the TTInstall command is issued
TTInstall.Mini-20200829.exe
Pause 2 This line is shown after the TTInstall command ran


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 26H2 Build 26300....
OS
Windows 11 Home x64 Version 26H2 Build 26300.9457
1 - do I have to change it like this?

Pause 1 TTInstall.Mini-20200829.exe -sd Central_Europe_1170_13183_tmp_0.ttpkg Central_Europe_1170_13183_tmp_1.ttpkg Central_Europe_1170_13183_tmp_2.ttpkg Central_Europe_1170_13183_tmp_3.ttpkg Central_Europe_1170_13183_tmp_4.ttpkg Central_Europe_1170_13183_tmp_5.ttpkg


2- I'm also posting another file. I don't know if it's a DOS problem. Maybe you can check with this exe. Nothing happens, while from another PC it always works with W11. Any ideas?

File
 

My Computer My Computer

At a glance

W10
OS
W10
do I have to change it like this?
Your post lacks line breaks.
Put a line break after every pause command line, as in my example.
e.g.
Pause 1 This line is shown before the TTInstall command is issued
TTInstall.Mini-20200829.exe -sd Central_Europe_1170_13183_tmp_0.ttpkg Central_Europe_1170_13183_tmp_1.ttpkg Central_Europe_1170_13183_tmp_2.ttpkg Central_Europe_1170_13183_tmp_3.ttpkg Central_Europe_1170_13183_tmp_4.ttpkg Central_Europe_1170_13183_tmp_5.ttpkg
Pause 2 This line is shown after the TTInstall command ran

The comments I have suggested after the Pause cmd itself can help you keep your place when interpreting misbehaving batch files.

2- I'm also posting another file. I don't know if it's a DOS problem. Maybe you can check with this exe. Nothing happens, while from another PC it always works with W11. Any ideas?

File
Please don't direct me to another site that I am required to register with & then log in to before being allowed to see whatever it is that you want me to see.
ElevenForum is capable of displaying batch files & diagrams without any help from other sites.


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 26H2 Build 26300....
OS
Windows 11 Home x64 Version 26H2 Build 26300.9457
the .bat launches another program in dos, on another pc it works
Typically, the path is incorrect/different, or the program not installed, or something like that.
If that is the only thing being done in the script, it just exits very quickly.

Tip, run your batch script the way it should be run, form Windows Command (CMD) and then you return to the prompt after the script, but above you'll see the script output.

There's many ways to debug this, but it depends on your tech knowledge regarding scripting.
 

My Computer My Computer

At a glance

Windows 11manymanymany
OS
Windows 11
Computer type
Laptop
Manufacturer/Model
Dell
CPU
many
Motherboard
many
Memory
many
Graphics Card(s)
many
Sound Card
many
Monitor(s) Displays
many
Screen Resolution
many
Hard Drives
many
PSU
many
Case
many
Cooling
many
Keyboard
many
Mouse
many
Internet Speed
slow
Browser
Firefox or Edge
Antivirus
different
sorry I made a mistake I noticed that the .bat file opens another program called TTInstall.Mini-20200829.exe and this is what then opens the DOS which does not process but closes
My understanding now is that this is no longer a batch file issue. That is, the batch file calls TTInstall.Mini-20200829.exe and then it launches a Command Prompt window that, apparently, does nothing instead of doing whatever it is that it was supposed to do.

The only other thing I can think of is that the batch file is not being run with Administrator privileges, which TTInstall.Mini-20200829.exe requires.

@Donnje, are you able to at least test opening an Administrator Command Prompt window and running the batch file from there? However, based on what you posted above, I'm not seeing any batch file parameters for TTInstall.Mini-20200829.exe, so unless those *.ttpkg files are being generated by batch file commands prior to the call to TTInstall.Mini-20200829.exe, then you should also be able to just test the TTInstall.Mini-20200829.exe command line as well (again, from an Administrator Command Prompt).

If Administrator privileges are not the culprit and, as you stated, TTInstall.Mini-20200829.exe is being successfully launched from the batch file, then the issue lies solely with TTInstall.Mini-20200829.exe, as it is the one opening a child Command Prompt window that is not doing what you are expecting.
 

My Computer My Computer

At a glance

Windows 11 Pro32GB
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Microsoft Surface Laptop Studio
Memory
32GB
Monitor(s) Displays
Three (3) Dell U3223QE
Screen Resolution
Surface: 2400x1600; Dells: 3840x2160
Hard Drives
1TB
If you read the cross-posted forum link, someone expressed the concerns that TTInstall.Mini-20200829.exe needs to be unblocked by your A/V software, and possibly needs to have the firewall rules opened for it...
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
In that context a simple question could also be : what happens if you try to start the application in another manner, for example through the Search field in Explorer, or via the Start Menu.
 

My Computer My Computer

At a glance

Windows 11manymanymany
OS
Windows 11
Computer type
Laptop
Manufacturer/Model
Dell
CPU
many
Motherboard
many
Memory
many
Graphics Card(s)
many
Sound Card
many
Monitor(s) Displays
many
Screen Resolution
many
Hard Drives
many
PSU
many
Case
many
Cooling
many
Keyboard
many
Mouse
many
Internet Speed
slow
Browser
Firefox or Edge
Antivirus
different
Back
Top Bottom