Hi,
Could someone please help me to solve the below scenario:
I need to copy a file from My Documents folder to "C:\Program Files (x86)\Folder" at the time of Maintenance/Repair of the application in the advanced installer(First time installation works fine). And that action should take place silently. Since the CopyFile is used in ProgramFiles folder, I need administrative privileges to run the script.
The following is the current script that am using:
dim objFSO, strSource, strTarget,strTarget1
set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
userProfilePath = objShell.ExpandEnvironmentStrings("%UserProfile%")
strSource= userProfilePath & "\Documents\"
strTarget = "C:\Program Files (x86)\Folder\folder1\"
strTarget1 = "C:\Program Files (x86)\Folder\folder2\"
dim strTempSource, strTempTarget,strTempTarget1
set strTempSource = objFSO.GetFolder(strSource)
file=userProfilePath & "\Documents\SQLConnections.xml"
If objFSO.FolderExists(strTarget) Then
set strTempTarget = objFSO.GetFolder(strTarget)
If objFSO.FileExists(userProfilePath & "\Documents\SQLConnections.xml") Then
objFSO.CopyFile file, strTarget,True
End If
End If
If objFSO.FolderExists(strTarget1) Then
set strTempTarget1 = objFSO.GetFolder(strTarget1)
If objFSO.FileExists(userProfilePath & "\Documents\SQLConnections.xml") Then
objFSO.CopyFile file, strTarget1,True
End If
End If
After opening cmd with adminstrative rights, and when running the code on cmd, it works fine. But when I put the code in advancded installer, it doesn't works.
Thanks in advance.