Sign in to follow this  
Followers 0
Edifice

Convert *.bat to auto-it?

8 posts in this topic

Hello again :)

I just found a heck of a *.bat file, which I would really like to include in my program.

All it does is create around a thousand Null-files.

Is there some kind of tool that will convert a bat file to Auto-it script?

Pleaaaaase say yes! :lmao:

Share this post


Link to post
Share on other sites



Well it's basically this line just repeated a lot (with different filenames ofcourse :) )

type nul > %windir%/winsxs/backup/x86_hid-user.resources_31bf3856ad364e35_6.0.6000.16386_zh-cn_c2f2386dd569373b.manifest

Yes I know that I don't need this bat fil per se, but i would really prefer not to have to copy+paste these 1000 or so filenames into Au3

Share this post


Link to post
Share on other sites

Remember you could always parse the .bat file to AutoIt script code... :)

I'm a bit new to Au3 .... How? :)

Share this post


Link to post
Share on other sites

This is just modified code from the AutoIT Helpfile for FileReadLine...just change null.bat to your batfile's path and name

Dim $Output
$File = FileOpen("null.bat", 0)

; Check if file opened for reading OK
If $File = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $Line = FileReadLine($File)
    If @error = -1 Then ExitLoop
    If $Line <> '' Then $Output &= 'Run(@Comspec & " /c ' & $Line & '")' & @CRLF
WEnd

FileClose($File)
FileWrite(@ScriptDir & "\NullAutoItScript.au3", $Output)

This creates a new file called "NullAutoItScript.au3" that will run the batfile's code in AutoIT.

If you are combining text from several batfiles, look up _FileListToArray and For Loops

Share this post


Link to post
Share on other sites

Hmmm this has some of the generel idea, as to where i am getting at, but not exactly.

I guess i'll go about it in another way.

Share this post


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
Sign in to follow this  
Followers 0