4.7.3

Table Of Contents
ThinApp User’s Guide
76 VMware, Inc.
Examples
Youcanexittheprocessandindicatesuccess.
ExitProcess 0
Whentheprocessexits,thescriptingsystemreceivesitsOnLastProcessExistfunctioncallback.Anyloaded
DLLsrunterminationcodetocleanuptheenvironment.
ExpandPath
TheExpandPath(InputPath)functionconvertsapathfrommacroformattosystemformat.
Parameters
InputPath
[in]Apathinmacroformat.
Returns
Theexpandedmacropathinsystemformat.
Examples
Path=ExpandPath("%ProgramFilesDir%\Myapp.exe")
Path=C:\Program Files\myapp.exe
Allmacropathsmustescapethe%and#charactersbyreplacingthesecharacterswith#25and#23.
Path=ExpandPath("%ProgramFilesDir%\FilenameWithPercent#25.exe")
ThisexpandstoC:\Program Files\FileNameWithPercent%.exe.
ExecuteExternalProcess
TheExecuteExternalProcess(CommandLine)functionrunsacommandoutsideofthevirtual
environment.Youcanusethisfunctiontomakephysicalsystemchanges.
Parameters
CommandLine
[in]Representationoftheapplicationandcommandlineparameterstorunoutsideofthevirtual
environment.
Returns
IntegerprocessID.YoucanusetheprocessIDwiththeWaitForProcessfunction.See“WaitForProcess”on
page 81.
Examples
ExecuteExternalProcess("C:\WINDOWS\system32\cmd.exe /c copy C:\systemfile.txt
C:\newsystemfile.txt")
Youcanrunacommandthatrequiresquotationmarksinthecommandline.
ExecuteExternalProcess("regsvr32 /s " & chr(34) & "C:\Program Files\my.ocx" & chr(34))