Jump to content

Win7 renaming Windows installation directory


Recommended Posts

Hello all.

Just wondering if anyone can shed any light on my current quandry....I'm doing a spot of customisation and I'd like to rename the Windows directory. I was able to accomplish this in Windows XP by using:

[SetupData]DefaultPath=\WinXP

...in TXTSETUP.SIF, but I can't find the equivalent functionality in Windows 7's install process. I have a similar problem with the "Program Files" directories. In XP's setup I was able to alter those using:

[Unattended]ProgramFilesDir="\Local"CommonProgramFilesDir="\Local\Common Files"

...in WINNT.SIF, but again, I can't find the equivalent functionality in Windows 7's install process. At least with the latter you can copy them, edit the registry and then delete the orignals. Not exactly an option with the system directory though.

My other avenue of enquiry is to make the changes into the WIM directly - rename the folders there and update the registry hives with the updated paths rather than trying to script the changes. The main hiccup I foresee is the bootloader probably generating the initial listing with the default path rather than looking up anything in the registry...anyone tried this already?

I know I could just hard link the names I want to the directories default names and then hide the default directories, but I do a lot of system-level work, so running with hidden files & directories isn't really an option for me.

Link to comment
Share on other sites

  • 2 weeks later...

  • 2 weeks later...

Well, I gave up on my attempt (covered in another thread) to make this all configurable using custom autounattend.xml sections and piggybacking off setup.exe (couldn't suppress offline setup's reboot to give it time to do its thing), and decided to go back to modifying the install image directly (dirs and registry). The Program Files twins are quite happy in their new locations, and I've just finished up modifying the system and profiles dirs. I suspect if there's a problem it'll be with the system dir...but given WinPE's happy running from X:\Windows, I have hope it'll work...

...but that fateful install can wait until tomorrow.

Link to comment
Share on other sites

  • 2 weeks later...

Weeeell, seems I've had some partial luck with my experiments that I figured I should share with people on the off-chance they come in useful. I don't expect anyone to consider this a good idea - but I always take being told you can't do something you used to be able to do as a challenge - hence why I stuck at it ;)

Basically, Windows quite happily supports running from a directory with any name, as I thought.

What fails however is dism.exe and dismhost.exe - these seem to have some horrible bugs forcing you to have a C:\Windows directory. dism.exe has a parameter that lets you specify the windows directory, but in my tests it seems to ignore this. I used my shim to rewrite the command line args being passed to the correct ones and some DISM functionality doesn't even try to use it - it just goes straight for C:\Windows. I tested this using ProcessMonitor with which I watched what was happening during the installation.

My set up was preparing my image with a renamed directory and a pre-edited offline registry (as mentioned before, ideally I want to transform a clean image dynamically so it's configurable - but this test is a proof of concept) - the first bit of setup copies this across fine. Setup then tries to fix up the offline registry - but annoyingly does so by - you guessed it - explicitly loading the hives from "c:\Windows\System32\config\". Workaround there is to add a junction back to the desired location and this bit then completes fine. The final phase is to install all the packages etc. and this is where dism's bugs come to the fore - despite the shim you still get the occasional access via C:\Windows - minimal, but still there.

Right at the very end however another bug pops up - "CBS", whatever it is, has a bug with paths - my desired path here is "C:\SBin\x86_64-Win64" - however this bit tries "C:\x86_64-Win64". Workaround here is another temporary junction and that gets you past it.

I've just let it finish downloading and installing all the updates and I now have a fully working up to date system with my system root in a non-standard location.

Link to comment
Share on other sites

Very good. :)

If and when you will have time it would be nice if you could post a more detailed list of the steps involved, which I am sure would be very useful to those wishing to install to "non-C:\Windows" :yes:

jaclaz

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...