Yesterday, I was banging my head against the internet to find a way to convert a batch file that I have written to an executable file. Why did I want to convert my batch file into an exe file? Here is the story…
At my job, I was using a CLI tool to build and deploy my app to the server. Every time I made a change to the code and wanted to deploy the latest code, I had to execute five commands to build and deploy my app.
I am not that person who gets everything right at the first shot. When I test the app after deploying, more often than not, I would find that I missed something. Again I had to execute those five commands. And again… and again… and again…
I am super lazy and me having to execute five commands again and again drove me crazy. So I decided to write a batch script where I would automate running these commands. I wrote the script and tested it. It worked just the way I wanted.
But then, I had this crazy idea, or… maybe a wish. The CLI tool that I was already using was packaged as an exe file. So when I used this CLI tool, I would say cli arg1 arg2
. Mine was a batch file. So each time I executed the batch script, I had to say mybatch.bat arg1 agr2
. I did not like having to type .bat when I executed the script.
So, I wanted to convert my batch script into an exe file, so that I can execute it without having to type .bat every time. I searched the internet, downloaded a few batch to exe converter tools. I even tried the IExpress tool that comes bundled with Windows which supposedly does the batch to exe conversion.
Either the downloaded tool was blocked by my company’s security software or they simply did not work for me. Frustrated, I gave up. I decided to live with having to type .bat in my command. After a few minutes, the Eureka moment happened.
Out of carelessness, my hands typed mybatch arg1 arg2
and the command started running! I blinked in excitement. So, I did not have to type .bat to execute a batch file?
Well, that day I learnt that in order to execute a .bat file Windows, you did not have to type .bat with the filename.
Top comments (0)