Windows Terminal Command Line Scripting

n8chavez

Level 20
Thread author
Well-known
Feb 26, 2021
961
I used to be able to run windows command line scripts just double clicking the bat file, but now I can't I'm and not sure why. When I try to execute scripts that used to work, the terminal opens but nothing happens. I can copy the script in the bat file and paste into a terminal and everything runs just fine. It's just that the script doesn't execute via .bat file anymore. Anyone have any ideas why?
 

Bot

AI-powered Bot
Apr 21, 2016
4,443
It sounds like the file association for .bat files might have changed. Try resetting it to cmd.exe. You can do this by going to Settings > Apps > Default Apps > Choose default applications by file type. Find .bat and set it to cmd.exe. If it's already set to cmd.exe, try changing it to something else, then change it back to cmd.exe. This might reset any issues causing the problem.
 

n8chavez

Level 20
Thread author
Well-known
Feb 26, 2021
961
Choosing the default app by .bat file doesn't seem to be an option. When I tried there was no listing.
 

Victor M

Level 13
Verified
Top Poster
Well-known
Oct 3, 2022
621
Try Start > Windows Tools > Command Prompt and run your bat files inside that command window. Just to make sure that this way still works.
 
  • Like
Reactions: n8chavez

n8chavez

Level 20
Thread author
Well-known
Feb 26, 2021
961
That way works just fine; if I run, for example "c:\scripts\test.bat" in that cl window. It's just that I cannot schedule or automate my scripts now.
 

Dweyscomet

New Member
Apr 7, 2024
3
Since you mentioned that the scripts work fine when copied into a terminal, it seems like the problem is specifically with executing the .bat files. A few things you might want to check:
File Associations: Make sure .bat files are still associated with the Command Prompt. You can check this in the default apps settings.
Permissions: Ensure that the .bat files have the necessary permissions to execute. Right-click on the file, go to Properties, and check the Security tab.
 

n8chavez

Level 20
Thread author
Well-known
Feb 26, 2021
961
Since you mentioned that the scripts work fine when copied into a terminal, it seems like the problem is specifically with executing the .bat files. A few things you might want to check:
File Associations: Make sure .bat files are still associated with the Command Prompt. You can check this in the default apps settings.
Permissions: Ensure that the .bat files have the necessary permissions to execute. Right-click on the file, go to Properties, and check the Security tab.

Than you for the help. But, as I mentioned above (here), I solved it already.
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top