NirCmd is a widely-used and well-tested program for basic system automation, and includes a "wait" function to start operations after another program has closed. When your program of choice shuts down, it can move settings stored in the file system to the local folder.
There are definitely more mature, more comprehensive tools available to enable portability, but Nircmd is small, easy, and actively developed. Anyone familiar with Windows batch operations should be able to make it work. This was tested on Windows 7x86.
Steps:
- In an existing program folder, save a copy of NirCmd. In this example, we'll be using Timeline
- Locate the folder where settings are saved (in the file \AppData\Roaming\.thetimelineproj.cfg)
- Create a text file and name it "Timeline Portable.bat" and paste in the following text:
Code: Select all
@echo off start "" copy /y "%userprofile%\AppData\Roaming\.thetimelineproj.cfg" . start "" timeline.exe start "" nircmd.exe waitprocess timeline.exe exec copy /y ".thetimelineproj.cfg" "%userprofile%\AppData\Roaming\"
- Launch Timeline Portable.bat
What's happening in this process
- Before the Timeline program starts, the config file (if present) is copied from it's normal location to the local folder(start "" copy /y "%userprofile%\AppData\Roaming\.thetimelineproj.cfg" .).
- The program is launched (start "" timeline.exe)
- Nircmd waits in the background for the process to close before copying the config file back to it's home (start "" nircmd.exe waitprocess timeline.exe exec copy /y ".thetimelineproj.cfg" "%userprofile%\AppData\Roaming\").
Alternative: delete rather than move
Note that it's also possible to just delete rather than copy settings, even though the whole point of portability is not having to re-enter the configuration over and over. As some programs with only a few settings changes are incidental, this can also enable program "stealth" status where no files are left behind on a machine.
Related:
- Mixere trick (uses a format similar to the above process to just delete settings)
- Enable portability with AdvancedRun
- YaP