Jump to content

quick question on compiling


Recommended Posts

Hi,

I got batch file that I want to run hidden using a compiled EXE from AutoIT. Here is what would be in the compiled EXE

Run("C:testbatchfile.bat", "", @SW_HIDE)

So the EXE runs the batch which opens a self extracting EXE created by WinRAR. Once the file is out and in %temp% it checks to see if the system it is running against is and x86 or x64. No biggie. You guys probably don't even need to know that, but just some quick info.

What I'd like to know is do I create the EXE with AutoIT using the 32-bit version? I would assume so, but just bare in mind the EXE created from AutoIT would need to be run on an x86 and x64 systems. I know you can run x86 on x64, but x64 can't run on x86.

Perhaps I am having brain fart. Just wanted to doublecheck.

Thanks guys.

Link to comment
Share on other sites

  • Moderators

Hi, Briandr. My first question is why you're running an AutoIt script to call a batch file to open a WinRAR file. Have you looked into simply calling the WinRAR file from the AutoIt script?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi,

Thanks guys for replying. Little clarification. Not yet using an AutoIT EXE. Right now I have a self extracting EXE created from WinRAR that contains a batch file that is extracted to %temp% and run. It opens in plain view. The user could click x and stop it. My thought would be to extract the AutoIT EXE and the batch file to %temp% and then run the AutoIT EXE.

To the first poster if I do as suggested and call the WinRAR EXE from AutoIT I still need to hide the command window that the batch file in the WinRAR EXE that will run. Can AutoIT help with that?

Link to comment
Share on other sites

  • Moderators

Yes, please post the contents of your batch file, and we can assist in getting it into your AutoIt script.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Ok. Here is the batch file.

After the batch is removed from the WinRAR EXE and placed into %temp% depending on the condition it may then pull out another file from the WinRAR EXE, Brian.scr and place it accordingly.

Thanks.

@ECHO OFF
Set RegVar=HKLMHardwareDescriptionSystemCentralProcessor0
REG.exe Query %RegVar% 2>NUL | find /I /N "x86">NUL
If [%ERRORLEVEL%] == [0] (
    echo X86
    cd %systemroot%system32
    If exist "brian.scr" ren "brian.scr" "brianold01.scr"
    GOTO FILEMOVE1
) ELSE (
    echo AMD64
        cd %systemroot%sysnative
    If exist "brian.scr" ren "brian.scr" "brianold01.scr"
    cd %windir%sysWOW64
    If exist "brian.scr" ren "brian.scr" "brianold01.scr"
        GOTO FILEMOVE2

)
:FILEMOVE1
COPY /Y "%~dp0brian.scr" "%systemroot%system32brian.scr"
exit
:FILEMOVE2
%systemroot%sysnativecmd.exe /c copy /y "%~dp0brian.scr" "%systemroot%system32brian.scr"
COPY /Y "%~dp0brian.scr" "%windir%sysWOW64brian.scr"
exit

Edited by Briandr
Link to comment
Share on other sites

  • Moderators

Hi, Briandr. Here are my suggestions, line by line:

  • You're testing a reg key to see if the CPU Architecture is x86 or not. In AutoIt, there are several macros do to this (@CPUArch, @OSArch, etc.) Check the help file for more.
  • Based on that, you can do a FileMove to rename the old file
  • Then you can do a FileCopy to copy down your new file.

The help file has good examples for you on all of these functions. Please feel free to post back here if you get stuck.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...