'========================================================================== ' ' NAME: Application launch script ' This script will check for specific .ini files, make decisions based on them, ' copy them, then launch an application ' AUTHOR: CitrixTools '========================================================================== Option Explicit 'Global variable declarations Dim oWSH Dim oWshShell Dim oFSO,sCommand Dim sUserHDrive,sUserHomePath,sUserClientName,objFolder Dim oUserProfilePath Dim osystemroot Const OverwriteExisting = True Set oWSH = CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") Set oUserProfilePath = oWSH.Environment("Process") 'Setup the environment variables for %homedrive%, %homepath%, and %clientname% osystemroot = oWSH.ExpandEnvironmentStrings("%Systemroot%") sUserHDrive = oUserProfilePath("HOMEDRIVE") sUserHomePath = oUserProfilePath("HOMEPATH") sUserClientName = oUserProfilePath("CLIENTNAME") 'Check to see if the folder "Temp" exists in the user's %homedrive%%homepath% directory 'if it does exist then do Nothing If oFSO.FolderExists(sUserHDrive & sUserHomePath & "\Temp") Then 'If the "Temp" directory doesn't exist then proceed Else 'Create the "Temp" directory Set objFolder = oFSO.CreateFolder(sUserHDrive & sUserHomePath & "\Temp") End If 'Check to see if a very specific .ini file exists in this directory 'this .ini file will be named %clientname%.ini 'if this %clientname%.ini does exist Then copy it To he user's %homedrive%%homepath%\windows and name it appspecific.ini If oFSO.FileExists("\\servername\sharename\directory\" & sUserClientName & ".ini") Then oFSO.CopyFile "\\servername\sharename\directory\" & sUserClientName & ".ini",sUserHDrive & sUserHomePath & "\windows\appspecific.ini",OverwriteExisting 'Launch the application oWSH.exec("Drive:\directory\application.exe") 'oWSH.exec("m:\windows\system32\mmc.exe") WScript.Quit End If 'If the %clientname%.ini file does NOT exist then the script will process the lines below 'Copy the appspecific.ini from the share into the user's %homedrive%%homepath%\windows directory 'this appspecific.ini file will be copied every time this script used to launch the application oFSO.CopyFile "\\servername\sharename\directory\appspecific.INI",sUserHDrive & sUserHomePath & "\windows\",OverwriteExisting 'WScript.Sleep 1000 'oWSH.exec("\\mdcoap500042\chpitmf01$\MHSNR Scripts\Impac\inisDR_TMHC.cmd") 'we will wait a second for the app to start 'ONE_HOUR=3600000 'ONe Minute = 60000 'One Second = 1000 WScript.Sleep 1000 oWSH.exec("Drive:\directory\application.exe")