Jump to content

.bat to .exe in autoit?


 Share

Recommended Posts

Is it possible to convert .bat files into .exes using autoit?

Not in one step, but wanting to do that is exactly what got me started using AutoIt! ;)

You rewrite the .bat file in AutoIt and then compile it like any other script.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

...or FileInstall() the .bat, run it, and delete it at the end of the script.

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Something like this PsaltyDS said:

#include <File.au3>

$PATH = FileOpenDialog("SELECT",@ScriptDir,"BAT File (*.bat)",1)

$LINE = _FileCountLines($PATH)
$FILE = FileOpen($PATH,0)
$EXE = FileOpen(@ScriptDir & "\EXE.au3",2)
FileWriteLine($EXE,"#include <Process.au3>")
For $INDEX = 1 To $LINE
    FileWriteLine($EXE,'_RunDOS("' & FileReadLine($FILE,$INDEX) & '")')
Next
FileClose($EXE)
FileClose($FILE)

You should make to compile automatic with aut2exe.

Use ShellExecute().

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Something like this PsaltyDS said:

#include <File.au3>

$PATH = FileOpenDialog("SELECT",@ScriptDir,"BAT File (*.bat)",1)

$LINE = _FileCountLines($PATH)
$FILE = FileOpen($PATH,0)
$EXE = FileOpen(@ScriptDir & "\EXE.au3",2)
FileWriteLine($EXE,"#include <Process.au3>")
For $INDEX = 1 To $LINE
    FileWriteLine($EXE,'_RunDOS("' & FileReadLine($FILE,$INDEX) & '")')
Next
FileClose($EXE)
FileClose($FILE)

You should make to compile automatic with aut2exe.

Use ShellExecute().

The only problem with that is that each line may not be independent...one line may check for the errorlevel of the one previous, for instance. Running a separate instance for each line would break that. So it depends on what you're doing (that is, what the batch file contains)
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
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
 Share

  • Recently Browsing   0 members

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