VBscript error during install
I have a vbscript that runs during install to overwrite an existing file based on a condition. It works fine if I don't have any spaces in the path such as C:\windows\newfile.txt but if I want to use C:\Documents and Settings\All Users\Application Data\OrderPad it will fail with a path error. Using 8.3 short names seems like a kludge fix and while it does actually work I still get the following errors in the windows installer log. Using CA type 70.
Log file
VBscript
Log file
Doing action: ConnPF
Action ended 11:54:06: InstallExecute. Return value 1.
MSI (s) (D0:64) [11:54:06:078]: Transforming table CustomAction.
MSI (s) (D0:64) [11:54:06:078]: Transforming table Binary.
MSI (s) (D0:8C) [11:54:06:090]: Note: 1: 1720
Action start 11:54:06: ConnPF.
Info 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action script error , : Line , Column ,
VBscript
'Create a text file
DIM fso, ConnFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set ConnFile = fso.CreateTextFile("C:\Documents and Settings\All Users\Application Data\OrderPad\OrderPad.exe.conn", True)
ConnFile.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
ConnFile.Write "<connection name=""LOCAL"" prompt=""False"" dataModified=""False"" />"
ConnFile.Close
0 Comments
[ + ] Show comments
Answers (6)
Please log in to answer
Posted by:
joedown
13 years ago
Posted by:
captain_planet
13 years ago
You should be able to do this:
but in any case, you need to check the 'OrderPad' folder exists first, and rather than hard coding the path use environment variables etc.....
Dim fso, ConnFile, folder
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("C:\Documents and Settings\All Users\Application Data\OrderPad\")
Set ConnFile = folder.CreateTextFile("OrderPad.exe.conn")
ConnFile.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
ConnFile.Write "<connection name=""LOCAL"" prompt=""False"" dataModified=""False"" />"
ConnFile.Close
Set fso = Nothing
Set folder = Nothing
Set Connfile = Nothing
but in any case, you need to check the 'OrderPad' folder exists first, and rather than hard coding the path use environment variables etc.....
Posted by:
joedown
13 years ago
Posted by:
anonymous_9363
13 years ago
Nice one, Cap'n. I've learned something today :-)
Joe, FFR, there is a dedicated 'Scripting' forum on AppDeploy.
Joe, FFR, there is a dedicated 'Scripting' forum on AppDeploy.
Posted by:
captain_planet
13 years ago
Posted by:
anonymous_9363
13 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.