CaTBuSMemberOct 25, 2007 at 8:58 am #128464
Rems has been helping me behind the scene and I wanted to post his work as I think it might help others. Also, this will allow others to chime in with additional ideas.
My question. How does one create a script to call a file (exe or msi) from a dynamic path. For example, I will be pushing out an application via sms. The sms package will consist of a folder containing 1 script and 1 msi. The problem is that the location of the package may differ therefore a static path such as (c:windowssms) will not suffice as the folder may exist in random locations.
Rems provide the below information. I have not yet tested it. I will report back later today with my results.Quote:Rems says: this example below and the links might get you started;Code:‘[url]http://www.microsoft.com/technet/scr…6/hey0405.mspx[/url]
strPath = Wscript.ScriptFullName
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile) & “”
strExeFile = “file.exe /parameters”
strCommand = chr(34) & strFolder & strExeFile & chr(34)
Set objShell = CreateObject(“Wscript.Shell”)
objShell.Run “%comspec% /c ” & strCommand, 1, False
Please feel free to add comments or alternate suggestions.
I want to thank Rems again for coming through with a solution. I am actually learning a lot from this help. Hopefully I will be able to return the favor at some point. Cheers.
You must be logged in to reply to this topic.