1
vote

I have used folder redirection to run Windows applications from removable storage, such as a thumb drive or network storage. The batch file shown below contains folder redirection commands for Pinta. It should be on the same drive as Pinta but does not have to be in the same folder.

cd /d  %~d0\"Pinta"
:: This will set some environment variables to the Pinta folder.
:: The program then uses the Pinta folder as the parent for the AppData
:: and .dbus-keyrings folders, and a gdbus-nonce-file.
:: An alternative is to set the environment variables to a folder on the same drive,
:: but outside of the Pinta folder.
SetLocal
:: set ALLUSERSPROFILE=%~d0\
set ALLUSERSPROFILE=%CD%
set PROGRAMDATA=%ALLUSERSPROFILE%
set USERPROFILE=%ALLUSERSPROFILE%
:: set APPDATA=%ALLUSERSPROFILE%
set    TEMP=%ALLUSERSPROFILE%
set     TMP=%ALLUSERSPROFILE%
START "Pinta" /wait Pinta.exe
:: erase /p AppData\Local\Mozilla
:: erase /p AppData\Roaming\Mozilla

Are all the set commands necessary? No, but I would rather go overboard than accidently leave out a set that was necessary.

This is what the batch file redirected to the Pinta folder during a short session. It would have redirected more folders if the user accessed the Internet through Pinta’s Help menu.

C:\Pinta
│   gdbus-nonce-file-8XC341
│
├───.dbus-keyrings
│       org_gtk_gdbus_general
│
└───AppData
    └───Roaming
        └───Pinta
                palette.txt
                settings.xml


Folder redirection is also useful for those that have the more limited objective of specifying the name and location of the configuration file. A user could bring their configuration file to a computer that already had the application. Specifying the file would also allow for more than one configuration. This use of folder redirection is unnecessary for applications where the configuration file can be specified on the command line.

The current Pinta version does not have a zip file that contains the binary files. So I used Universal Extractor 2 to extract the files from the exe file to the Pinta folder.

suggested 11 months ago
stephen-leibowitz
None