Hello,
When I package my vbscript file in PrimalScript 2009 to become the .exe file, I have the option to have the extracted script file and the icon file to be placed in a separate folder that is different from the script folder.
In the script code, I have the output log files written to the current folder where the packaged script file (the .exe file) also resides.
When I run the packaged script, the output log files are written to the folder where extracted script file and the icon file are located.
I don't want to hard code the folder location for the output log files in the script since I don't know what folder I will place the packaged script (the .exe file).
How can I have the packaged script write the output log files to the packaged script's current folder while the extracted script file and the icon file be placed in a separate folder?
Thank you in advance.
Packaged script needs to write output file
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Packaged script needs to write output file
Sorry - I take that back.
Try this:
CurrentDirectory points to the folder where the script is unpacked.
Try this:
Code: Select all
MsgBox WScript.Path
Set shell = CreateObject("WScript.Shell")
MsgBox shell.CurrentDirectory
CurrentDirectory points to the folder where the script is unpacked.
Packaged script needs to write output file
I guess that means that thius worked. Yes you cannot take the default here as it will place files in the extraction folder. WScript.Path is where WScript (cscript) was launched from. I ssuspect this is local to teh EXE because CSCRIPT is launched as a child of the EXE and would inherit the EXEs environment. This will always be the same.
'CurrentDirectory' will be the location script is that is executing UNDER cscript. This can be changed by the script at any time but will be the script location initially.
'CurrentDirectory' will be the location script is that is executing UNDER cscript. This can be changed by the script at any time but will be the script location initially.