vinifera Posted September 3, 2020 Share Posted September 3, 2020 (edited) so heres my problem; in this specific case, but would be nice even for any future problem in any way... waterfox profile folder is this: "%HOMEDRIVE%%HOMEPATH%\AppData\Local\Waterfox\Profiles" but on every new pc the default user profile folder is garbled mesh and always different generated in my current install it is named c5prw4uk.default (so full path is "%HOMEDRIVE%%HOMEPATH%\AppData\Local\Waterfox\Profiles\c5prw4uk.default") my question is, how to make within BAT/CMD script, so when you do DIR /A:D (to show only directories) that name of that folder which is displayed gets set in %variable so i can do cleaning of c5prw4uk.default\cache\*.* anyone understood ? Edited September 3, 2020 by vinifera Link to comment Share on other sites More sharing options...
Mcinwwl Posted September 3, 2020 Share Posted September 3, 2020 Question - is it mandatory to get it done in CMD? looks like something I can get done in Powershell, but old batch scares me off. Link to comment Share on other sites More sharing options...
vinifera Posted September 3, 2020 Author Share Posted September 3, 2020 yes i'm avoiding powershell Link to comment Share on other sites More sharing options...
jaclaz Posted September 4, 2020 Share Posted September 4, 2020 I am not sure to understand fully, however: @ECHO OFF SETLOCAL FOR /F "tokens=* delims=" %%A IN ('DIR /A:D /B "%HOMEDRIVE%%HOMEPATH%\AppData\Local\Waterfox\Profiles\" ^|FIND /I ".default"') DO SET myvar="%%~dpnxA\cache\*.*" SET myvar should do. This will only work if there is only one .default directory, or if there are more than one it will get the variable set to the last one jaclaz 1 Link to comment Share on other sites More sharing options...
vinifera Posted September 4, 2020 Author Share Posted September 4, 2020 (edited) it works nicely, but for some reason it echoes myvar=full path\*.* (its not big thingie, i'm just curious why, and can it be avoided) Edited September 4, 2020 by vinifera Link to comment Share on other sites More sharing options...
jaclaz Posted September 5, 2020 Share Posted September 5, 2020 Sure, remove or REM the line SET myvar (that was made to let you check visually that it worked as expected) Also as is it was intended to be a line in a more complex batch, so you might need to remove the SETLOCAL line to have the myvar definition "static" in the environment. jaclaz Link to comment Share on other sites More sharing options...
vinifera Posted September 5, 2020 Author Share Posted September 5, 2020 (edited) i hate to be one of those guys but i just noticed this, if full path is "%HOMEDRIVE%%HOMEPATH%\AppData\Local\Waterfox\Profiles\random.garbage.folder\cache" but variable returns "%HOMEDRIVE%%HOMEPATH%\random.garbage.folder\cache" (so \appdata\local\waterfox\profiles) is missing :/ maybe i can ease the calculation of ...something., I just need the random.garbage.folder name, not the full path, nor anything after (dunno if that makes it easier for you) Edited September 5, 2020 by vinifera Link to comment Share on other sites More sharing options...
jaclaz Posted September 6, 2020 Share Posted September 6, 2020 (edited) The: SET myvar="%%~dpnxA\cache\*.*" Is not really-really carved in stone, try replacing it with SET myvar="%%~nxA" this should be only the name and extension of the folder which contain ".default". Or try: SET myvar="%HOMEDRIVE%%HOMEPATH%\AppData\Local\Waterfox\Profiles\%%~nxA\cache\*.*" Now you see the usefulness of the SET myvar line, don't you? As a side note I doubt it is the "correct" way (remember you asked for this) to find the name of that folder, I mean, unless Waterfox has some peculiar encrypted/encoded way of storing its settings, that folder name and path is written *somewhere*, either in a .ini (or .config file or similar or in the Registry as Waterfox needs obviously to know it, so the more "proper" approach would be to read it from where it is written, instead of using the (subject to possible errors/conflicts/collisions/whatever) DIR /A:D approach. jaclaz Edited September 6, 2020 by jaclaz 1 Link to comment Share on other sites More sharing options...
vinifera Posted September 6, 2020 Author Share Posted September 6, 2020 (edited) Quote Now you see the usefulness of the SET myvar i use ECHO %myvar% Quote As a side note I doubt it is the "correct" way (remember you asked for this) to find the name of that folder i think firefox classic does this, coz PaleMoon makes same thing, and i use Waterfox based on FF classic (not proton) ALSO --- THANK YOU SO MUCH Edited September 7, 2020 by vinifera Link to comment Share on other sites More sharing options...
jaclaz Posted September 7, 2020 Share Posted September 7, 2020 (edited) 12 hours ago, vinifera said: i think firefox classic does this, coz PaleMoon makes same thing, and i use Waterfox based on FF classic (not proton) Sure, whatever does that, it also reads that, so that path/directory name is written *somewhere* and the proper approach remains to read that same path/directory (*wherever* it is written) INSTEAD of using the DIR | FIND ".default", which is intrinsecally prone to error in case of name collision. 12 hours ago, vinifera said: ALSO --- THANK YOU SO MUCH You are welcome jaclaz Edited September 7, 2020 by jaclaz Link to comment Share on other sites More sharing options...
vinifera Posted September 7, 2020 Author Share Posted September 7, 2020 (edited) you were right in appdata\roaming\waterfox\profiles.ini [Profile0] Path=Profiles/c5prw4uk.default but dont make nothing... since i dont need nothing more than you already did and it works perfectly ! Edited September 7, 2020 by vinifera Link to comment Share on other sites More sharing options...
jaclaz Posted September 7, 2020 Share Posted September 7, 2020 Wait until you have a Profile1 besides the Profile0 ... jaclaz Link to comment Share on other sites More sharing options...
vinifera Posted September 7, 2020 Author Share Posted September 7, 2020 i wont have Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now