Hey guys,

Sorry if this is in the wrong section, couldn't find a section for working on batch files.

Anyway, here's my problem. I've made a firefox theme, and am distributing it. In order for the theme to work properly, the user needs to copy two files into a directory called "chrome". For some reason, a lot of people have problems finding the chrome directory, so I want to create a .bat file that automatically opens it for them.

Here is the exact location of the 'chrome' folder on my computer:


C:\Users\Andrew\AppData\Roaming\Mozilla\Firefox\Profiles\2xvz43gb.default\chrome


Please take special note of the random characters that are in bold in the directory above. That is the user's default profile directory, which is automatically created by Firefox during installation. As you can see, inside that directory is the chrome directory which I am trying to find and open.
However, that is where my problem lies. When Firefox creates the default profile directory which is in bold above, it assigns random numbers and letters before the .default extension. Which means that on different computers, the directory will have a different name (ie- 12345.default on one computer and abcde.default on another computer).

Using %RANDOM% does not work of course, but I have no idea what to do, because I know very little about .bat

Can someone please help me out and show me how to code this so that I can find and open the chrome directory?

Here is my current code:

@echo off
color 0a
echo Thanks for downloading the Baltimore Ravens Firefox theme!
pause
cls
echo This program will find and open the 'chrome' directory of your Firefox browser. Once the directory opens, please copy the userChrome.css and userContent.css files into the 'chrome' directory, and restart Firefox
pause
cls
echo Please report any bugs to me at: flynismo@gmail.com
pause
cls
[B]explorer C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\2xvz43gb.default\chrome[/B]

The line in bold is what I need to fix.

Thanks in advance for your help!

Batch files have nothing to do with shell scripting. Please find an appropriate forum.

Which would be where exactly? As I said at the begining of the post, I am not sure where this thread belongs.

The other Windows sub-forums present here are a bit h/w oriented so I guess I'll leave this post here for the time being and also try getting the description of this sub-forum changed so that it can incorporate shell scripting of any sort (powershell, bash, batch etc).

@flynismo
Try breaking it down in two steps; something like:

cls
echo Please report any bugs to me at: flynismo@gmail.com
pause
cls
cd C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*.default
explorer chrome

But keep in mind that if more than one .default directory exists, it'll pick up the one which comes first (in alphabetic sorting sense).

Also, you might want to double check the path since on my machine the Profiles directory resides at the location: C:\Documents and Settings\<USERNAME>\Application Data\Mozilla\Firefox\Profiles

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.