Jump to content

Changing Program Files Path


Recommended Posts

Alright, I am making an unattended XP disc for my new sexy PC. I want windows to install its program files into a directory named Programs inside the windows directory. After the windows installation is done though, I want the default program installation directory to be %systemdrive%/Applications.

Here is what I was thinking of doing so far:

1). In my winnt.sif file, have the ProgramFilesDir set to "\Windows\Programs" (and have CommonrogramFilesDir set to "\Windows\Programs\Common").

2). At first startup, use GuiRunOnce (set up in winnt.sif) do some registry tweaks and whatever else is necessary.

The thing I am not sure about is, in step 2, what changes I have to apply to the registry, if it is possible to set the registry entry for the program files directory using %systemdrive%, and if I have to do anything else to get this working. Any help here would be greatly appreciated, and since this is my first post here on the MSFN forums, feel free to bash me on the head if I posted this in the wrong place or I didn't look well enough for an answer.

Link to comment
Share on other sites


Thank you very much for that search link, altough for some reason on my home PC I am not getting the same serach results (I get ones completley unhelpful there). The serach gave me 3 results, one of which was useful. From reading http://www.msfn.org/board/lofiversion/index.php/t18054.html, I'd download RCC (not sure if I should get version 1 or 2), stick it (along with all batch files and reg files listed here) in %OEM%\$$\Tweaks.

First GuiRunOnce would execute this file:

replace.cmd

RRC search /text="%%ProgramFiles%%" /replace="C:\Windows\Programs" /data /noprompt

However I would like to make it use whatever the %systemdrive% is in place of C:\. That is problem 1.

Next it would make these registry changes:

tweak.reg

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"ProgramFilesDir"="C:\Applications"
"CommonFilesDir"="C:\Applications"

Problem 2 is I would, once agian, like to use %systemdrive% in place of C:\ so it will work no matter what my drive path is.

Problem 3: what do I do with the registry value at "ProgramFilesPath"?

Any help with these would be very nice.

Link to comment
Share on other sites

I think you're making this more complicated than it really is.

These two reg entries are all that matter.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]

"ProgramFilesDir"="d:\\Program Files"

"CommonFilesDir"="d:\\Program Files\\Common"

So it shouldn't be necessary to use another tool to search and replace the whole registry.

Something like this in a cmd should do what you want:

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion /v ProgramFilesDir /t REG_EXPAND_SZ /d %systemdrive%\Applications /f

Edited by Takeshi
Link to comment
Share on other sites

Oh cool, thanks! I didn't even know you could replace registry entries with an entry of a different data type.

As for not having to do anything else, according to http://www.msfn.org/board/index.php?s=&amp...st&p=123878 , doing it that way will "f+ck up IE and OE" (and maybe some other default programs too, from looking at comments on various sites about chaging the program files directory). However, if you are sure it wont screw anything up if I just set those two registry entries, then I guess I will try it out when I get home.

Thanks again for the help.

Link to comment
Share on other sites

Point taken. TBH you have to see what happens but I can tell you that when I changed the ProgramFilesDir to D manually, IE Cum updates refused to install. I don't know if other changes in the variable is needed. But I'm just a bit wary of replacing it globally in the registry.

The other thing is, that post was in 2004. Things might have changed since XP SP2.

Perhaps you could give us your feedback later.

Link to comment
Share on other sites

1). In my winnt.sif file, have the ProgramFilesDir set to "\Windows\Programs" (and have CommonrogramFilesDir set to "\Windows\Programs\Common").

I use this method. At the first logon some Microsoft programs are already installed in the default Program Files folder unless you specify a different one in winnt.sif. I think [GuiRunOnce] method adds an extra complexity in this case.

Link to comment
Share on other sites

Sorry I didn't respond with an update for a while, I had no internet for few days due to blue-screen issues.

Just having the modified winnt.sif file and then doing the registry changes didn't work so well. Windows did install it's programs to "%systemdrive%\Windows\Programs" as desired, but "%systemdrive%\Program Files" was still there (empty, so it could just be deleted anyway, not a big issue), and for some reason the windows programs had created a bunch of empty folders in "%systemdrive%\Applications". I think the reason they did that is the same reason to do that search and replace thing with RRC.

For now though, I decided instead of putting all of windows's default stuff in one folder I'm just gonna give it it's own partition, and have a seperate partition for apps and games. Thanks for the input.

Link to comment
Share on other sites

Thanks for your feedback. I forgot to say not doing the search and replace did not mess up the ordinary working of OE and IE. Did it in your case?

As for some empty folders created after changing the default prog dir, it did in my case too.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...