Solved

VB script not finding path

Posted on 2014-11-13
7
106 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
Industry Leaders: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 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