MSFN Forum: Need to create .EXE file with three lines of code from VBScript - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need to create .EXE file with three lines of code from VBScript Rate Topic: -----

#1 User is offline   randalldale 

  • Member
  • PipPip
  • Group: Members
  • Posts: 113
  • Joined: 16-November 04

Posted 03 November 2009 - 10:35 AM

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.

Randy


#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 03 November 2009 - 01:48 PM

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.
;!@Install@!UTF-8!
GUIMode="2"
InstallPath="%SystemRoot%\\system32
OverwriteMode="1"
RunProgram="DiskPart.exe /s OSPart.txt"
Delete="OSPart.txt"
RunProgram="nowait:\"InstallOS.hta\""
;!@InstallEnd@!


#3 User is offline   Scr1ptW1zard 

  • Junior
  • Pip
  • Group: Members
  • Posts: 57
  • Joined: 05-July 07

Posted 04 November 2009 - 05:59 AM

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:

[LaunchApps]
%SystemRoot%\System32\wpeinit.exe
%SystemRoot%\System32\mshta.exe, %SystemRoot%\System32\InstallOS.hta

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy