Solved

VB script not finding path

Posted on 2014-11-13
7
105 Views
Last Modified: 2014-11-18
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.
0
Comment
Question by:xzay1967
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:jkaios
ID: 40441786
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

0
 

Author Comment

by:xzay1967
ID: 40443769
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.
0
 
LVL 12

Expert Comment

by:jkaios
ID: 40444088
Just outta curiosity, y do u have to manually create that folder when the FF installer can do during its installation process?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:xzay1967
ID: 40444680
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.
0
 
LVL 12

Expert Comment

by:jkaios
ID: 40445013
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
0
 

Author Comment

by:xzay1967
ID: 40446392
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.
0
 
LVL 12

Accepted Solution

by:
jkaios earned 500 total points
ID: 40449431
So the process would be to install Firefox first and then run the script, and to put it in code it would be like:

If objFSO.FolderExists("C:\Program Files (x86)\Mozilla Firefox")                           'step 1 - created during FF installation
   objFSO.CreateFolder("C:\Program Files (x86)\Mozilla Firefox\distribution")              'step 2
   If objFSO.FolderExists("C:\Program Files (x86)\Mozilla Firefox\distribution")
      objFSO.CreateFolder("C:\Program Files (x86)\Mozilla Firefox\distribution\bundles")   'step 3
   End If
End If

Open in new window

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question