Pages

Please leave a comment as often as you see fit.. :)

Saturday, September 1, 2012

Wrap a BAT or VBS into an EXE

There is no way to convert a .vbs files or .bat files into an executable (.exe file) because they are not a compiled language. The process of converting source code into native executable code is called "compilation", and it's not supported by scripting languages like VBScript or Batch Files.

Alternatively, there are ways to wrap VBScript and BAT code files in to a standalone executable file. There is a native Windows tool called IExpress which you can wrap a vbs or bat into an .exe.

In XP or Windows 7 press windows key + r ( OR click Start, click Run) for Run dialog box. Then enter iexpress in Run dialog box, and click OK. This starts the IExpress Wizard.

1.     On the IExpress, select Create new Self Extraction Directive file and hit Next.

2.     Select Extract files and run an installation command and click Next.

3.     On next page type a title for your package and click Next.

4.     On the Confirmation prompt page, select No prompt and click Next.

5.     On next page, select Do not display a license and click Next.

6.     On the Packaged files page, click Add and select the vbs script or bat from the directory in which it resides:

7.     When you finish adding files, click Next.

8.     On the Install Program to Launch page, in the Install Program box,type;

 c:\windows\system32\cscript.exe “yourVBS.VBS OR yourBAT.BAT” 

OR

 c:\windows\system32\wscript.exe “yourVBS.VBS OR yourBAT.BAT”

Leave the Post Install Command box BLANK.

9.  On the Show window page, select Hidden and click Next.

10.  On the Finished message page, select No message and click Next.

11.  On the Package Name and Options page, enter the path and file name that you want for this distribution package. Check both boxes and click Yes to the warning under Options and click Next.

12.  On the Configure restart page, select No restart and click Next.

13.  On the Save Self Extraction Directive page, select Save Self Extraction Directive(SED) file:, edit the path and name of the file, and click Next.

14.  On the Create package page, click Next. When the package has been created, click Finish to exit.

15.  The package will now be created with the name you specified and have an extension of .EXE.

Now you can wrap and send your funny VBScripts and Batch files as exe file. ;)


3 comments:

  1. well, ExeScript compiler will saves you a lot of time, compile in a second

    ReplyDelete
    Replies
    1. c:\windows\system32\wscript.exe “yourVBS.VBS OR yourBAT.BAT”
      sir plz tell me wscrip.exe k baad yourVBS.vbs file me double qoutes aayega ya nhi

      Delete
    2. double quotes are required..

      Delete