I would like to make sure that the program never writes to local disk folders such as C:\Users\USERNAME\AppData\Local\NAMEAPP.
I tried with
[DirectoriesMove]
Local-App-Data = C:\Users\USERNAME\AppData\Local\NAMEAPP
but while the program is running the path is written temporarily which I would like to avoid.
I think you need to redirect folders but I don't know if this is possible.
Thank you and good evening.
Stephen
It's up to the app itself. If the app doesn't support redirecting that (something like -settings:X:\PathToSettings on the command line) then you have to do it this way. The only way around it would be virtualization, which we don't do.
Sometimes, the impossible can become possible, if you're awesome!
For example, app that's written using Electron usually has parameter to override data directory, i.e.,
--user-data-dir=DATA_DIRECTORY
. Some apps also check if a specific environment variable exist, such asQBT_PROFILE
for qBittorrent andVSCODE_APPDATA
for Visual Studio Code. Others also check for local file or folder existance, such asportable_mode.txt
for OBS Studio,portable.dat
for CCleaner,portable
folder for VLC, and many more.If the app doesn't provide native portable mode then there's nothing much to do other than using portable launcher like PAL. However there is a dirty trick by altering
USERPROFILE
,APPDATA
, andLOCALAPPDATA
environment variable to the path of your choosing, this is not recommended as it also affects every subprocesses launched by that app (possible corrupting other launched app). You can also contact the app maintainer if the project is open-source and simply wait until it's being implemented (less pain and probably the best way).EDIT: Symlink and junction is also possible but currently can't be done using PAL (without adding custom code), also requires administrator privileges which is impossible for normal user to gain access to. Probably not working on non-NT filesystem (FAT, FAT32, etc).
Hello. I'm really sorry to wake up this old thread. But, this is the only thing I could find which could be of any you to me. You said >"However there is a dirty trick by altering
USERPROFILE
,APPDATA
, andLOCALAPPDATA
environment variable to the path of your choosing" and I would like to know how to do that using a batch file in windows. I'm really struggling with simple stuff, please help me(I'm NEW). This is just for my knowledge. Thanks!Creeper1722
Some apps use other methods to detect environment variables, so it may not work. Also do not skip
USERPROFILE
if you want to emulateAPPDATA
andLOCALAPPDATA
path.Batch file is more useful for setting
PATH
since NSIS has max string length limitation.