Jump to content

Is batch file worth it on 2021?

Hi.

 

I'm using batch files for some time now, but is Batch File worth it on 2021?

 

Just asking.

 

Please note that my answers is based on experience.

 

Dell Vostro 270s | Core i3 2100 | Windows 10 | 4GB DDR3 RAM

 

This text should not be seen on Dark/Night mode.

This text should not be seen on Day/Light mode.

 

 

 

(\__/)
(='.'=) This is Bunny. Copy Bunny into your signature to
(")_(") help him on his way to world domination.

 -Rakshit Jain

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Slottr said:

Does it do what you want?

It does. I made something that beats some EXE files by using a batch file.

 

Please note that my answers is based on experience.

 

Dell Vostro 270s | Core i3 2100 | Windows 10 | 4GB DDR3 RAM

 

This text should not be seen on Dark/Night mode.

This text should not be seen on Day/Light mode.

 

 

 

(\__/)
(='.'=) This is Bunny. Copy Bunny into your signature to
(")_(") help him on his way to world domination.

 -Rakshit Jain

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, jbcarreon123 said:

It does. I made something that beats some EXE files by using a batch file.

Then its all good.

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 3600 || GPU: RTX 3070|| Memory: 32GB @ 3200 || Cooler: Scythe Big Shuriken || PSU: 650W EVGA GM || Case: NR200P

Link to comment
Share on other sites

Link to post
Share on other sites

The answer is always IT DEPENDS. Mostly no.

 

How many hours have you spent making the batch file when some existing application or some script written in other programming language could have been done in 15-30 minutes?

How easy is it for someone to understand the batch file and make changes should you become incapacitated in some way (or if at work, maybe you leave to a better job or get fired)

How easy it is to add features, add options, tweak the batch file to fit better your needs?

 

The 2nd is the reason a lot of companies prefer to stick to slower interpreted languages like Python or even Javascript over optimizing something to Go or C or assembly, because they'd have a harder time to find people capable of understanding the language and being able to debug/fix bugs/add features etc. 

 

I consider myself a decent programmer but I never learned batch programming, and the syntax is too horrible for me, don't want to pollute my brain with it. 

It's faster for me to open notepad++ and write a PHP script or some javascript and do the same thing a batch file would do, only much more customizable. 

 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, jbcarreon123 said:

I made something that beats some EXE files by using a batch file.

what is it

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, akio123008 said:

what is it

same, I am curious as to what compiled machine level language is slower than interpreted scripting language.

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, akio123008 said:

what is it

12 hours ago, Franck said:

same, I am curious as to what compiled machine level language is slower than interpreted scripting language.

 

https://github.com/jbcarreon123/Win11CompChk

I made it before I joined this forum.

 

Please note that my answers is based on experience.

 

Dell Vostro 270s | Core i3 2100 | Windows 10 | 4GB DDR3 RAM

 

This text should not be seen on Dark/Night mode.

This text should not be seen on Day/Light mode.

 

 

 

(\__/)
(='.'=) This is Bunny. Copy Bunny into your signature to
(")_(") help him on his way to world domination.

 -Rakshit Jain

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, pretty much any application would run faster and better than that batch file. 

Just looking through the code, i'm shaking my head and groaning ... it's full of PING commands used just to delay printing text on screen to make it look fancier, and full of searching for strings in logs (a proper application would just retrieve the data directly using API or from registry or from hardware IDs or whatever).

Your batch basically runs powershell and various commands to dump logs of those commands and then picks information from logs of those commands... it's crap way of doing it.  

Also... are you even keeping track of the temporary files dumped in %temp% to remove them once you're done? I don't see any care about that anywhere in the batch. 

 

edit: yeah, i see the delete log batch files separately ... with 90% of the batch file  ping commands to animate the text "Now loading in console... "  loading what, you goof ... cut the script kiddie stuff and make something professional and to the point instead of wasting someone's time with pointless stuff. 

 

Not to mention you just do  del %temp%\*.log  as if your batch script is the only thing that could possibly make files with the .log extension in the temp folder.

 

Maybe I don't want to have logs from other things deleted (ok, fine, technically temp folder is for temp stuff, unreliable, not to rely on, no mans land, any app could override stuff  but you could just make a random temporary folder within %temp% for every instance of your batch file and then empty the folder and remove it when you're done. 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, jbcarreon123 said:

 

https://github.com/jbcarreon123/Win11CompChk

I made it before I joined this forum.

You got a couple ping of 500 ms already in there and most compiled language will have everything done under a 2000 ms. Even using a elaborate method such as using CPU-Z + HWI command line with another compiled language instead of calling the OS directly would be faster. CPU-Z + HWI usually under 8 seconds total on quad core 6gen intel.

Link to comment
Share on other sites

Link to post
Share on other sites

I like how somehow it jumps from version 1.4.1 to version 5.0.0 in the same day 😛

 

In terms of use, I say use whatever you are comfortable in. Sometimes I write Python scripts, sometimes I resort to Bash voodoo. It's simply whatever suits me best at that moment.

Crystal: CPU: i7 7700K | Motherboard: Asus ROG Strix Z270F | RAM: GSkill 16 GB@3200MHz | GPU: Nvidia GTX 1080 Ti FE | Case: Corsair Crystal 570X (black) | PSU: EVGA Supernova G2 1000W | Monitor: Asus VG248QE 24"

Laptop: Dell XPS 13 9370 | CPU: i5 10510U | RAM: 16 GB

Server: CPU: i5 4690k | RAM: 16 GB | Case: Corsair Graphite 760T White | Storage: 19 TB

Link to comment
Share on other sites

Link to post
Share on other sites

15 hours ago, mariushm said:

it's full of PING commands used just to delay printing text on screen to make it look fancier

You know I was wondering about those? Seems like printing the initial "fancy" stuff and then just using a TIMEOUT command would have been easier? Of course I'm sure I have stuff in things I've done that makes people wonder.

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/6/2021 at 6:53 AM, OhioYJ said:

TIMEOUT command would have been easier

Timeout limits to 1 second. so if I used timeout commands, it takes 20 seconds to open up menu.

 

Please note that my answers is based on experience.

 

Dell Vostro 270s | Core i3 2100 | Windows 10 | 4GB DDR3 RAM

 

This text should not be seen on Dark/Night mode.

This text should not be seen on Day/Light mode.

 

 

 

(\__/)
(='.'=) This is Bunny. Copy Bunny into your signature to
(")_(") help him on his way to world domination.

 -Rakshit Jain

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, jbcarreon123 said:

Timeout limits to 1 second. so if I used timeout commands, it takes 20 seconds to open up menu.

It is limited to whole seconds, but my initial thought was just printing the graphical stuff, wait a second so it's seen and then move on. That's how my backup script works, after the menu, you briefly shows what you selected, then starts running.  What ever gets the job done. I'm sure there are people wondering why I have some complex script just to do backups.

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/3/2021 at 8:47 PM, jbcarreon123 said:

Hi.

 

I'm using batch files for some time now, but is Batch File worth it on 2021?

 

Just asking.

For what you are using it for not really.  Bat files have it's purposes still...mainly if it's something that is quick and wont need a ton of logic in it...or when I need it to be portable and run on a massive amount of Windows systems without worrying.

 

That is the reason why I choose batch files over things such as powershell (as not all systems easily run powershell...or rather you need to then create a batch to easily call the powershell script, or signing your ps script).  It's something that can easily be modified and runs on pretty much any windows machine.

 

Real world examples of where I still using bat files.  Moving over some of my dev. releases...since the binaries are in a consistent location, and it's a simple one line command.

3735928559 - Beware of the dead beef

Link to comment
Share on other sites

Link to post
Share on other sites

Well, .bat files have an advantage that they'll run on any Microsoft system starting from DOS 1.0 🙂 but Powershell has also been around for 15 years or so. It offers more functionality, and, if you're interested if your PC will run Windows 11, you're probably running Windows 7 at the very least 🙂

 

In terms of code readability, something like Python would allow to cut your code 10 times at least and make it more understandable, but it would require the user to install Python first (or maybe nowadays you can just write a short .ps1 file to auto-install Python using Winget, then to use it to run the Python script and dump its output to the PowerShell window).

Link to comment
Share on other sites

Link to post
Share on other sites

FreePascal is free and you can probably make your executables compatible even with 386 with it.   I think the latest Delphi has some 'community' / free version as well, but not sure.

There's PureBASIC which is free and would do programs just fine : https://www.purebasic.com/download.php

Go would also work and compiles everything in the executable, nothing else required

 

Hell, you could write such a tool in Visual Basic 6, you'd just have to bundle the 1 MB-ish runtime DLL file with your executable and it will work just fine.

 

Wrote tools that did stuff like importing 10 csv files with names and phone numbers and removing duplicates and export a single csv file... or loading a million phone numbers from a list and removing blacklisted phone numbers that were stored in another file... you can do that in Visual Basic 6 in 10 minutes, while it may take that much just to prepare the environment and project in other languages. Just as easy to do in PHP but person using the tool wanted to click on buttons to open "Select folder" or "open file" dialogues to select the files, and didn't want to use command line to specify the file names.

 

I often write a script in php and run it like a batch ... just bundle the php.exe and the actual php dll and optionally any extensions you may use, individual dlls) in the same folder  and drag the php script on php.exe or make a tiny batch / cmd file to launch the php script.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Powershell might be a better alternative, because you have some amount of cross compatibility.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, WolframaticAlpha said:

Powershell might be a better alternative, because you have some amount of cross compatibility.

Powershell's object based paradigm is way different from cmd though, and the cross compatibility is pretty minimal. Most non windows machines are much more likely to have python, bash, or java installed than they are to have Powershell. And that's not even getting into the problems you run into if you want use some of the new Powershell 6 or 7 features, and then have to explain to your users that even after installing Powershell 7 they still have Powershell 5 and your script really only works on 7. 

 

I think that Powershell is in for a few years of the same weirdness Microsoft did with Edge/IE as they try to move people to the new platform, while maintaining the old side by side. For as long as there are two competing versions of Powershell for Windows users, I can't really recommend using it for anything aimed at audience beyond Powershell super fans. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×