Jump to content

Is it bad to run a .exe as a .bat?


Recommended Posts

Question first:

Is it ok to rename a compiled AutoIT script to a .bat file? Would running a compiled AutoIT script as a .bat cause any problems?

Background on Why I want to do this crazy thing:

I am writing a backup utility that is going to be replacing an ancient app that was started via a .bat file.

Now, because the old app has been around a LONG time who knows where the end users have made shortcuts for the .bat file, so it will be difficult to do the update as seamless as possible.

The .bat file is very simple and simply launches the old app with some command line switches.

My new backup utility will ignore the switches so I was just going to replace the old app with the new one and let the .bat file launch the new app.

This works but it leaves a stupid black dos window in the background until you close the new app. "Did the same for the old app"

Now, i decided to try and replace the .bat file with my new app not thinking it would actually work but it does... is this bad :whistle:



Link to comment
Share on other sites

Question first:

Is it ok to rename a compiled AutoIT script to a .bat file? Would running a compiled AutoIT script as a .bat cause any problems?

I tried it and it does work - but what is in a name? If the users all have shortcuts to the original *.bat file then changing it to the newer version will not affect them. If they all have their own copy, then it really makes no difference what you do as you will have to have them delete the old copies anyway to have the newest version run. If you have a need to keep the file as a *.bat file I fail to see the reason, as the end user is not going to care as long as the program works.

Other than that, I would see no reason why the program would work by changing the extension. As a matter of fact I even changed it to *.com and it still ran fine. I never even thought of changing the extension for a test like this and wonder why it would run. I would think that for both EXE and COM files that it would have some type of header explaining the type of file and if it did not match the extension - abort. I know that you will have to be careful if you have all the files named the same as there is a pecking order - COM EXE BAT (I think that is right, but I do not have any old DOS books to look at)

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."



WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes




GDI Basics


GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...