Link to home
Start Free TrialLog in
Avatar of xzay1967
xzay1967

asked on

VB script not finding path

I am working on a vb script to build a package to install firefox. The actual installation works fine, but there are other parts of the process I need completed that is not happening. There are some files that need to be copied. Here is the part of the code that is failing.

objFSO.CreateFolder("C:\Program Files (x86)\Mozilla Firefox\distribution\bundles")
when I run the script i get a path not found error. The environment is W7 64bit.
Avatar of jkaios
jkaios
Flag of Marshall Islands image

Try check if folder exists first:

If objFSO.FolderExists("C:\Program Files (x86)\Mozilla Firefox\distribution\")
   objFSO.CreateFolder("C:\Program Files (x86)\Mozilla Firefox\distribution\bundles")
End If

Open in new window


Or if the version of Firefox you're installing is 64 bit, then it probably resides in:

objFSO.CreateFolder("C:\Program Files\Mozilla Firefox\distribution\bundles")

Open in new window

Avatar of xzay1967
xzay1967

ASKER

Thanks for the response, the version of FF is not 64bit, it is 32bit, so it would reside in Program Files (x86). That folder does not exist, so no need to check for it first. I have to create it, that is so that the next line of code can copy some files and folders to it so that when FF is launched, it will make an add-on available to all users. The code errors at the line where it is supposed to create the folder. If it was error-ring at the point of the copy code, I could understand, but it does not make it that far. Oddly though, the lines of code prior to that line reference the program files (x86) folder and there are no issues.
Just outta curiosity, y do u have to manually create that folder when the FF installer can do during its installation process?
That folder is not a standard folder with the installation. The purpose is to create a location for the add-on that will be made available to all users that log on to the computer. I am open to any suggestions that can make this process painless. Installing FF is the easy part, the trick is to make the add-on be installed and available and enabled for any user that logs on.
OK I think the "CreateFolder" method canNOT create nested folders in one call so u have to change your code to create each folder one by one as follows:

1. Create the main folder "Mozilla Firefox"
2. Create subfolder "distribution" inside main folder
3. Create subfolder "bundles" inside the distribution folder
Hmm, I will try that when I get to work. I did however try that on my home computer and that worked. The only change I made was to not create the Firefox folder cause it already get created when it is installed. Once I apply the solution at work I will provide a feedback.
ASKER CERTIFIED SOLUTION
Avatar of jkaios
jkaios
Flag of Marshall Islands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial