Changing Windows public folder in batch script

3

I've installed Steam on an external hard drive so I can play games on different computers by just moving the drive around. Since save games are often saved in My Documents or AppData, but I want them to move with the external hard drive, I wrote a batch file that sets environment variables before starting steam.

setocal
set USERPROFILE=%EXTERNAL_LETTER%\Profile\Me
set APPDATA=%USERPROFILE%\AppData\Roaming
...
start %TARGETAPP%
endlocal

I'm not sure if this is the right way to do this on Windows, but it seems to work.

However, one game saves its games in the Shared Documents folder. I've tried setting %PUBLIC% and %ALLUSERSPROFILE% but that does not seem to affect where the game looks. Is it possible to make this one program use a different Shared Documents folder, either by environment variables or some other means?

The change in Shared Documents should only affect the one program, I do not want it to be a permanent or system wide change to Windows.

Angus

Posted 2009-11-13T12:17:55.103

Reputation: 131

What game is it? – admintech – 2009-11-13T13:21:12.133

Stalker: Shadow of Chernobyl – Angus – 2009-11-13T20:49:22.477

Answers

1

Ah, STALKER.

If you're in Vista, or 7 (or above, for people reading this in the future), you can use NTFS symbolic links to redirect the saving, but you will have to do that one every PC you play the game on. It's a command line tool, and works like so:

mklink /H Link Target

As in, you'd move the save file to your external HDD, open a cmd window, cd to the save directory, and go mklink /H [save name].sav %EXTERNAL_LETTER%\Saves\Stalker\[Save Name].sav

Phoshi

Posted 2009-11-13T12:17:55.103

Reputation: 22 001

1+1, I was going to suggest the same thing - symbolic links sound like the optimal solution here. – nhinkle – 2010-10-15T08:16:06.817

0

Look at the registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

I believe this is the "Common Documents" key, whose value on my machine is "%PUBLIC%\Documents".

You might try to set PUBLIC, or if this doesn't work, write a script that saves and changes this key in the registry.

harrymc

Posted 2009-11-13T12:17:55.103

Reputation: 306 093

Setting PUBLIC does not work. I'm wary of editing a registry key but I'll try it. – Angus – 2009-11-14T06:18:30.040