Solved

VB script not finding path

Posted on 2014-11-13
7
96 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now