4.0.4

Table Of Contents
ThinApp User’s Guide
112 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 117.
Examples
ExecuteExternalProcess("cmd.exe /c copy c:\systemfile.txt c:\newsystemfile.txt")
Youcanrunacommandthatrequiresquotationmarksinthecommandline.
ExecuteExternalProcess("regsvr32 /s " and chr(34) and "c:\Program Files\my.ocx" and chr(34))