.bat File Compliers?

Just wondering why these exist in the first place. Like, I can understand for convenience purposes, but if there are other reasons why, what are they? This as well as “run” files. Seems like these would point or be some sort of security vulnerability as they do not go directly through Java IDEs etc…

Batch files are not compiled. They are interpreted and basically run watered down powershell.

They probably exist for convenience. Someone who does a lot of basic windows scripting might find them useful.

As for security, I’m not sure what you mean. Anyone can just open batch files with notepad and look at them.


Bat files specifically:
.bat files were introduce long long time ago, before windows was a thing. And now are supported as a convenience and compatibility.
.bat file is an very, very simple, and very, very old example of a scripting language.
Windows supports .bat files along with current MS tool of choice (PowerShell) for backward compatibility mostly.

As for scripts/script files in general:
I think Dynamic_Gravity nailed the personal reasons for using script files.

As for the “industry” here are the real benefits of using scripting languages:

  • those are soft elements (even softer - compared to general software as is), that can potentially be changed without going through full procedure like building, testing, acceptance testing, user testing, when you build a software product
  • they kind of are the right tool for the job, the language structure makes more sense to do what you want to do
    • run some commands in a sequence
    • calculate some values
    • most Java servers usually have a starting script
    • automation
  • allow for end user modification, or even if they are not intended for that (or hidden) allow for modification without touching compiled/builder package before shipping to customer
  • allow for adaptation by distributor of a software package
  • yes they are kind of security vulnerability but benefits overcome the drawbacks. It is easier to say to the end user, “you know, if you change here the value to two it will work for you, let us know how it works”, than “we specially compiled a new version of the program for your specific configuration of the machine, but in order to get it you will need to pay 10,000$ for our testing/release procedure”, The latter will not work for both sides.

The Java it self is a good example that software elements have a huge degree of “softness” in them:

  • it is a language compiled to intermediate binary format, but this binary format is not executable on actually any real computer
  • this binary code is both interpreted and recompiled by the JVM (JIT comiler) to the native machine code
  • and to have second level of inception (or third - counting that Java program could be started by a script) , there are various dynamic scripting languages used in Java. Like MVEL

I do not know how steam works internally, but my assumption that there is some scripting inside was correct:

In this case one specific group of end users of Steam platform (the developers) can use tested and closed components of their platform in order to create installation packages.


batch files are similar to HTML, they describe a set of actions to be taken by software.

Basically they are shortcuts for making it easier to execute a set of commands (ffmpeg uses batch files, to give one example that isn´t the windows command line).

1 Like

This is probably the best short description one can get.

1 Like

I agree. They are short high-level instructions. They don’t really do anything, they just tell the computer to do stuff it already knows how to do in a specific order.

1 Like

But they can be.

The first thing that comes to mind when you might want to do this is for macros, where some things will allow an .exe but not a .bat. Perhaps something with scheduled tasks, though I think you can use bat files natively but maybe there might be something to an AD forest where exe makes sense. You could also possibly pack it into an msi for use via group policy installation to quickly push out (or update) a particular thing on all your computers in the forest in one go. I’m sure theres some niche for it but never needed it myself.

EDIT: also see:

1 Like

Ahh so its like a fancy wrapper.

Every now and again, our 3L windows support group would give us batch files to do stuff. Usually, to force install mcafee and update its database.

Then that would breech policy. But I see your point.

bat to windows is
bash to linux
No ?
I remember using batch files all the time in DOS

No, bash is a shell. The equivalent would be powershell on windows for the user shell.

The closest thing in linux would be a .sh file with shell commands in it.

one reason i can think of is if you were to want to obscure the workings of the file. no it won’t defeat someone determined but it will prevent the casual observer looking at what it does and using that info to perhaps move files around to interfere with it maliciously.

and potentially make it run faster, though that’s a stretch.

i still use batch files for simple stuff. cmd.exe is way, way faster than powershell.

I haven’t checked these tools, but these are almost always just an EXE unpacker that ends up running the batch files at a later state.

Also, batch is horrific to work with, why would you subject yourself to it?

I’ve stopped using Windows before powershell was a thing.

.bat files are scripts at their simplest, basically lists of commands (basically whatever you can do in cmd, you can do via .bat file or batch file) … super handy if you want to just chain a couple of utilities, but totally scarry if you think of them as being an actual programming language.

Is powershell going to be a thing I’ll have to learn in the future if I just end up wanting to start some utilities with specific command line flags on Windows?

In short, yes. Unlike Batch, PoweShell has deep integration with the Windows system and most of the Windows configuration GUI is just running the same command accessible via PowerShell.

Also, PowerShell is great coming from bash. Everything as an object is amazing, screw having to grep/sed/awk your way through your scripts.

If you’re an IT guy i’d seriously suggest spending some time with powershell. It is available on macOS and Linux as well. But most of the libraries, etc. aren’t. So windows mostly at the moment.

That said, it is very powerful and being object based is very different to traditional scripting languages.

The object based thing cuts both ways. It requires a mental shift from awk/sed/etc. as above and can mess with your head when all you want is to get some text output.

Linux will definitely eventually have something like powershell, if not powershell itself.

I hate microsoft as much as the next guy, and frequently powershell pisses me off (it’s slow, there are sometimes bugs, etc.) but the concept is a game changer - and it is definitely the way command line administration will go eventually in my opinion.

And for those reasons, you should get at least a working beginners knowledge of it.

As an example of the power available, try this at a powershell prompt

get-wmiobject -list

get-wmiobject win32_bios | format-list * | more

The way they talk about it would seem to disagree but I’ll test this theory later. Also when I learned IT there was no powershell.

EDIT: it would seem it does indeed wrap the bat

I doubt this very seriously. Theres no need for it on linux when you already have bash scripting, which is more powerful than powershell currently.

no, it isn’t.

go learn powershell.

In its current form on linux, yes it is.

Thats gonna be a hard no for me. No need or desire.

of course it is limited on linux right now. it’s an early port to a non native platform and the reason much of it is missing on linux is because linux doesn’t have a copy of the .net objects powershell works with.

use it on windows for an example of what powershell can be.

similar functionality, whether it is powershell or some open source clone will pop up on linux sooner or later. because powershell makes things that are a complete pain in the balls to do on linux trivial via powershell on windows.

bash or any other unix she’ll doesnt even come close. and i say that as a windows hater.