Jump to content

Need to create .EXE file with three lines of code from VBScript

Recommended Posts

Hi Guys,

I need some help. I have no experience with C++ but need to figure out how to write a .EXE that can do the following lines from my VBScript.

Set objWShell = CreateObject("WScript.Shell")

objWShell.Run "cmd.exe %systemroot%\system32\diskpart.exe /s %systemroot%\system32\ospart.txt",0,True

objWShell.Run "%systemroot%\System32\InstallOS.hta"

I need to create a MyShell.exe to call in my WinPE winpesh.ini file with those lines.

Has anyone done such a thing? I've tried four recomended conversion programs and none will run in WinPE 3.0.

Thanks for your help, if I'm asking too much then that is fine too.


Link to comment
Share on other sites

Have you explored other avenues?

For example you could create a self extracting 7-zip executable file using the modified 7zip sfx here. Inside the archive you could place ospart.txt and InstallOS.hta, and run the diskpart and hta programs from your config file. This could also mean that you wouldn't have to pre-place your files in the system32 directory before running your executable.

Here's an example config.txt which may help if you decide that such an idea will suit.

RunProgram="DiskPart.exe /s OSPart.txt"

Link to comment
Share on other sites

I use a .hta as my shell under WinPE also.

You can add these lines:

Set objWShell = CreateObject("WScript.Shell")

objWShell.Run "cmd.exe %systemroot%\system32\diskpart.exe /s %systemroot%\system32\ospart.txt",0,True

to your InstallOS.hta and set the shell (in winpesh.ini) like this:



%SystemRoot%\System32\mshta.exe, %SystemRoot%\System32\InstallOS.hta

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
  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...