Running Paint.Net from Removable Storage
Stephen Leibowitz for Windows 10 and later can be downloaded here. The last version for Windows 7 was 4.3.12 and can be downloaded here. Both locations include installer and portable versions. The portable versions do not write to the Windows registry, but they write to the \Users\username\AppData\Local\ folder. Also, at least one plugin, G'MIC, writes to the \Users\username\AppData\Roaming folder. Users that want to run PDN from a removable drive, such as a thumb drive, may prefer that those writes be to the removable drive.

Folder redirection is a lightweight method built into Windows that can be used for this. It does not need before run/after run moving. An environment variable for the location of the username folder, including its subfolders, is set to the removable drive.

I have written a batch file to run PDN from portable storage. The batch file should be on the same drive as PDN, but does not have to be in the same folder.

By default, the environment variable redirects PDN’s AppData entries to the application folder. To increase the separation from the code, the user can specify a location for these entries that is outside the PDN program folder. For example, the user may have multiple apps on a removable device, with a shared AppData folder on the device for them. The batch file has commented-out commands for this.

Also, some non-PDN AppData writes may be redirected if they are a result of running PDN. In particular, pressing the F1 key will bring up PDN documentation in the user’s default browser. Most of these writes can be ignored because they take up little storage and are not needed after the PDN session. But the Firefox browser will write a larger amount. The batch file includes two commented-out commands to erase files after PDN finishes.

cd /d  %~d0\""
:: This will set USERPROFILE to the folder.
:: The program uses this as the parent for the AppData\Local folder.
:: An alternative is to set USERPROFILE to a folder on the same drive,
:: but outside of the folder.
:: set USERPROFILE=%~d0\
START "PDN" /wait paintdotnet.exe
:: erase /p AppData\Roaming
:: erase /p AppData\Local\Mozilla

As an alternative to the batch file, some program launchers can set environment variables, in addition to launching PDN.

It is straightforward to work on image files stored on the same drive as PDN or on other local drives. You may also store the images on network drives. The Windows Map Network Drive facility or the Net Use command can be used to assign (map) an available drive letter to a network storage space. Here are specific instructions for Microsoft OneDrive.

© 2022 Stephen Leibowitz