Solved

VB script not finding path

Posted on 2014-11-13
7
101 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

11 Experts available now in Live!

Get 1:1 Help Now