Background

Have you ever wanted to convert a .bat file, Visual Basic script, or PowerShell file into an executable. Since Windows XP, Microsoft has included the iExpress Wizard as part of its operating system. iExpress is a simple conversion tool which embeds a script into a .exe file. Although this isn’t a true .exe compiler solution, it is good for one-off scenarios, and iExpress works with operating systems spanning Windows XP all the way to Windows 10.

Solution

The steps below outline how to convert a PowerShell or Visual Basic script to an executable file.

  1. On a computer, click Start, and type iexpress, and click OK.
  2. Open iexpress as an administrator

  1. On the Welcome to IExpress 2.0 page, select Create new Self Extraction Directive file and click Next.
  2. On the Package purpose page, select Extract files and run an installation command and click Next.
  3. On the Package title page, type a title for your package and click Next.


  4. On the Confirmation prompt page, select No prompt and click Next.
  5. On the License agreement page, select Do not display a license and click Next.
  6. On the Packaged files page, click Add and select the vbs script 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,
  9. For PowerShell type:

    PowerShell.exe -noprofile -Sta -executionpolicy bypass -File-fileName.ps1

    Sample – PowerShell.exe -noprofile -Sta -executionpolicy bypass -File Excel-Report.ps1


    For VB type c:\windows\system32\cscript.exe “yourVBS.VBS”  OR 
    c:\windows\system32\wscript.exe “yourVBS.VBS”

    c:\windows\system32\cscript.exe “EMC_Option2.vbs”

  10. On the Show window page, select Hidden and click Next.
  11. On the Finished message page, select No message and click Next.
  12. On the Package Name and Options page, enter the path and filename that you want for this distribution package. Check both boxes and click Yes to the warning under Options and click Next.


  13. On the Configure restart page, select No restart and click Next.
  14. 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.
  15. On the Create package page, click Next. When the package has been created, click Finish to exit.
  16. The package will now be created with the name you specified and have an extension of .EXE

  17. The PowerShell script kicks off once the .exe file is executed