How to move the WinSxS directory in Vista

December 5, 2007

in Microsoft, Vista

Update 11/20/2008: WinSxS, Disk Space and Windows 7.  I encourage everyone to read this post first before you consider moving your WinSxS directory.  You may just change your mind.

What is the WinSXS directory?

I stumbled upon a post in a forum the other day and as I began to read I suddenly realized that the author has solved a long standing issue I had with Vista, the HUGE WinSxS directory.  According to Microsoft literature this directory can not be moved or deleted.  Sounds like a challenge to me.

The following process outlines how to move this directory to another location.  This process is not for the faint of heart but if followed carefully will get the job done.  A certain degree of computer knowledge is assumed.  I’ve include a link to the original post to give credit where credit is due…and cleaned up the language a bit to make it easier to read.

Thanks Paul for your hard work…

WARNING: Proceed at your own risk.  Incorrectly performing the following procedure may cause irreversible damage to your OS.  It is highly recommended to backup your system before proceeding.  This is an unsupported mod. Microsoft will not support you (and I cannot) should you choose to move the WinSxS directory.

  1. You will need two utilities: PendMoves and MoveFile.  Place them in \Windows\System32 directory for easy access.
  1. In Windows Explorer navigate to the \Windows\WinSXS directory.  Right click the directory to bring up the quick menu and select Properties.  Click the Security tab to view the security properties. You will need to assign the Administrator user account ownership of the directory and then grant the Administrators group Full Access.
  2. Open an administrator command prompt, and create a dummy directory.   Execute “mkdir c:\windows\winsxs.moved
  3. Next, create a junction (like a Symbolic link for Vista).  Execute “mklink /J c:\windows\ winsxs.moved
  4. Now delete the winsxs.moved directory. Execute “rmdir c:\windows\winsxs.moved
  5. Now we will use MoveFile to schedule renaming of the WinSXS directory at reboot. This is the magic that will give us control over the directory.
  6. From the administrator command prompt, execute “movefile c:\windows\winsxs c:\windows\winsxs.moved“. As you can see, this is renaming the WinSxS directory before Vista can get a lock.
  7. From the command prompt, run “movefile c:\windows\ c:\windows\winsxs“. This puts a winsxs directory back (as far as Vista is concerned), so everything doesn’t collapse in a heap.
  8. From the command prompt, run “pendmoves“. It will show the two pending moves you’ve entered above, with NO ERRORS. If it all looks good, REBOOT!
  9. On reboot the critical renames/moves will execute, and the WinSxS directory will be unlocked and able to be moved in the next steps.
  10. Open an administrator command prompt, and execute “dir c:\windows\winsxs*“. If you performed the previous steps correctly, you’ll see a WinSxS.moved directory and the WinSxS junction.  If it did not work, repeat the above steps.  Our next step is to relocate the WinSXS directory and amend the junction.
  11. Using Windows Explorer, COPY the entire WinSxS.moved directory to a \Windows directory on another partition or drive.
  12. When the copy is finished, rename the new directory from WinSxS.moved to WinSxS.
  13. Go to an administrator command prompt and execute “rmdir c:\windows\winsxs“.
  14. Then, execute “mklink /J c:\windows\winsxs d:\windows\winsxs“.
  15. To be sure everything is happy, in Windows Explorer browse to c:\windows\winsxs. You will see all of the files.  (Even though they are actually on your other partition or drive)
  16. Reboot
  17. After reboot, you should be able to delete c:\windows\winsxs.moved and FINALLY liberate all that disk space.  Whew!  Now take a bow.

This process can also be applied to the Windows Updates directory.  When you download Windows Updates etc., the files get placed into C:\Windows\SoftwareDistribution, and this will quickly become huge. It is easier though… stop the Automatic Update service, move directory, create junction, restart service, DONE!

1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 4.63 out of 5)
AnnihilatorX March 19, 2008 at 2:16 pm

You ought to be careful with that though. Some updates, notably Vista SP1, would fail with an error numbered 80070011 if you junction the winsxs or program files folder.

Thomas October 24, 2008 at 11:26 am

This worked like a charm on my vista with SP1! I would like to mention that I had to give ownership to an account called “Administrator” for the movefile to work.

Matt November 5, 2008 at 12:53 pm

Thanks Thomas, I’ve udpated the post to include this new information.

Adamess October 25, 2008 at 10:01 am

Is that really working? I want to move this folder, but i don’t want to kill my system 🙂

Slycer November 4, 2008 at 7:37 pm

Oh, GOD! Thanks Thomas! I spent an hour wondeing what went wrong. It’s a good guide but you really should make a note that the account that needs to take ownership is Administrator not your own account. Even if it’s in the Administrators group, apparently. Anywho, thanks Thomas.

Mike November 14, 2008 at 12:35 pm

Hi, every step in this guide works, but after last reboot i can´t delete winsxs.moved
Now I have one copy on drive C and one on drive D. Can you help me pls?

I can rename It, move It everywhere on drive C (not to D) but that´s all.

To be sure everything is happy, in Windows Explorer browse to c:\windows\winsxs. You will see all of the files. (Even though they are actually on your other partition or drive)

this is last what work

Akul December 28, 2008 at 1:52 pm

please help when i try to reboot the blue screen apears

Matt January 5, 2009 at 10:00 am

Unfortunately, their isn’t much you can do here. Restoring the system from a backup or rebuilding is about all you can do. I wish I could offer more here.

Matt Martin December 30, 2008 at 11:45 am

Hi. I did all the steps and everything looked good … but once I did the first reboot, my system was done it will not boot up … keeps restarting on its own … I wouldn’t recommend this for anyone that’s not willing to risk losing their system .. luckily I don’t really care lol I just reinstall vista

mjornir September 10, 2010 at 1:00 am

If only it was that "simple"…. i have the same problem, but there's a catch-a very big one at that. i dont need to move this file (unless move =shred, ooops, the s word, hope MS didnt hear that). i am trying to reinstall win 7, but cant get a fresh install because formatting (using another pc/win xp pro/backed by mcaffee shredder/with assisting UNLOCKER) cant remove the files in its entirety, meaning the same problem im having (MS-namely) is never removed in fist place.
acer extensa 5620 3 GB RAM ORIG sold w/ vista NOW using 7 vista/7 keeps shutting down dvd drive and wireless Changed both to older units w/o MS controllable firmware (dvd/wireless no more issues now) shuts IE down NOW using firefox…
for the past 2YRS on a now 2 yr old pc, i have blue screen o D on a almost daily rate… i currently have to run w/ certain services down to minumize BSoD. by the way, BSoD is using the windows update cant update call0x0………408/00005 and a few others…because i get hit with rounds of updates that causes issues so i removed sam's ability to download….

bottom line: i need a software(s) that will make MS feel my pain so i can regain my pc….

any solutions? thanks in advance….

Roald January 2, 2009 at 3:56 pm

Answer to Mike:
I had the same problem after reboot. Setting “Full Control” access to “Administrators” for the winsxs.moved directory and all descendents did the trick. Actually, I gave that access right to absolutely all users on the system, just to be on the safe side. After all, I deleted it immediately afterwards anyhow.

Thanks Matt!!!

cougar694u January 22, 2009 at 4:31 pm

For anyone who bsod’s their box because of this, I found a way to bring it back.

I killed a Win2k8 server by fat-fingering the mklink and not noticing it before a reboot.

This is what I did to repair:

1) Boot from the install CD (WinServer2k8 in my case, could also use Vista disk, I imagine)

2) After selecting language, the next screen has an install button, but at the bottom is a link to repair the system. It should detect your installation, select it and click next (or load RAID/Disk controller if needed).

3) Select command prompt from the next window. When the command prompted opened, I did a “dir c:\windows\winsxs*” and saw both folders, with the winsxs pointed to “C:\window\winsxs.moved” (notice the missing s??). I did a “dir c:\windows\winsxs.moved” to verify all my files were there, then ran “rmdir /s/q c:\windows\winsxs” to get rid of it.

4) I copied the contents of winsxs.moved to d:\windows\winsxs with the following command:

xcopy c:\windows\winsxs.moved\* d:\windows\winsxs /h/i/c/k/e/y/x

That copied all 32,312 files over I had in my dir.

5) Ran “rmdir /s/q c:\windows\winsxs.moved” and “mklink /J c:\windows\winsxs d:\windows\winsxs”

6) Ran “dir c:\windows\winsxs*” showed the junction of the winsxs directory pointing to d:\windows\winsxs.

7) typed exit, then clicked the reboot button on the window.

After that, the system booted up fine, thank God!

I checked the c & d drives and the space had changed accordingly (removed about 5g from the c and added about 5g to the d).

I hope this helps someone else out there who kills their, box as I did.

cougar694u February 19, 2009 at 2:52 pm

It should also be noted that this will break Windows Updates.

Sure, it works as an interim fix if you have no other options, but it’s not for the long term.

Simon April 23, 2009 at 3:42 am

Several people have commented that this will break windows updates.

This should be obvious to anyone that has looked into winsxs, its structure and how files are added to it.

winsxs contains HARD LINKED files that are placed there during updates or installs.

Hard links can only work within a volume, they cannot work across volumes, which is what junctions allow you to do.

You won’t see any errors until a later program tries to create a hard link in c:windowswinsxs from outside of it and will fail with a probably obscure message.

A work around would be to restore winsxs to its original location, run the update then move it back to the other volume with the above procedure, but I think that would defeat the point of attempting the above.

There are tools around that will shrink the size of winsxs by removing all old revisions of files and replacing them with hard links to the latest version of each file but this does require that the software using that works with the latest version – it may do, but you are risking all the dll hell problems that winsxs was designed (albeit badly) to cure

jorgewolf June 27, 2009 at 8:20 pm

its immposible in win7.
i have tried 3 times….
asus EEE 901 4gb/8gb.
win7 lite of 3.5 gb after install…

i follow all the steps carefully….

allways the same error…

i reboot and get stucked after 10 secs of restarting… black screen…. no harddrive led….
i thout could be the files moving or linking….and let it work more than 4 or 5 hours….
black screen….

3 times… same result….hours and hours….

i just want win7 on my 4gb asus eee whit a minimum of 700 mg free to work.

ufischer February 8, 2010 at 8:10 pm

I went through the above process to move winsxs to a mechanical drive from my SSD drive on a Win7 professional system and had a long process to finally get rid of the residual .dll files from winsxs.moved on the C: (SSD) drive. It kept denying me access. I tried closing all processes and services I could. I even shut down windows explorer, but still couldn’t get rid of the remaining 107MB worth of DLL files from the hundred or so very long named folders in that winsxs.moved folder.

In the end, I choose to boot in system repair mode and went to command prompt. I eventually found my C: drive (it was E: drive in the repair mode command prompt box) and was then able to use DOS commands to remove the remaining .dll files and the huge stack of subfolders. Once I did that, I was then able to finally get rid of winsxs folder from the windows folder using a single rm winsxs.moved command.

Anyway, If I ever have to do this again, I’ll go to repair mode command prompt right away and save myself a couple of hours of messing around.

Thanks Matt. It would probably have taken another day or so of messing around without these instructions.

ufischer February 24, 2010 at 6:02 pm

Win 7 Updates kept failing after I moved winsxs as the above procedure. I tried putting in a /D link to SoftwareDistribution on in the same E: drive folder but still no updates.

I tried making a link to e:C-movedFrom\Windows\SoftwareDistribution from c:\windows\SoftwareDistribution a /J link instead of a /D link but Win7 still doesn’t accept updates.

Does anyone have a way to get updates happening without keeping all this stuff on the C: drive? I don’t mind if automatic updates don’t happen as long as I can go through the normal manual Win7 updates processing.

mjornir September 10, 2010 at 1:26 am

you cannot delete/remove/jam windows update w/o compromising your pc. MS licensing states we have one of three options: 1-recieve updates via MS, 2-via manufacturer, 3-via none at all… MS is lying. to remove sam's ability to update (modify) your pc, means that MS cant control what you do… example:cd rom dvd burners are all the same except for the firmware in the unit. Proof, win 7 allows you now make a non r/w cd into a live cd format. with that said, Poser as in poser 3d graphicssoftware requires certain files to be linked using mac format (on a pc!), which in turn tells me that after i delete/shred (gone forever) the files in c:/windows/winsxs/ (the really long filename files), i still have over 7 GBs of files on a 3x formatted hard drive that keeps getting recovered when i reinstall win 7/vista etc. how do i PERMANENTLY ERASE THESE FILES? OOOPS, I SAID THE "E" WORD. MY BAD…SORRY MS…

eddie October 1, 2010 at 10:27 pm

windows 98 fdisk then format to fat32 or utility called zap then format fat32

@pingram3541 October 30, 2010 at 4:12 pm

I was able to get updates working by changing the file path entries from c: to z: where my junctions point to:

as well as searching through my registry for winsxs and cganing the path from %SystemRoot% to z:windows. There was only 5 entries, one of which was only a key name and 2 of the remaining 4 had x:windows which I beleive is left over from my original installation so I only actually changed the 2 with the %systemRoot%…I wonder if %SystemDrive%windows would have worked too?

Anyways, I was able to install my updates and then after rebooting I changed the registry values back.

Ajay December 27, 2010 at 12:12 pm

Oh i just recovered from BSOD wow feels great.First mistake did not get authority for “movefile c:windowswinsxs c:windowswinsxs.moved“ got error 5 proceed to reboot anyway it failed .Then got authority using .reg file from link above.But ailed to copy to d:windowswinsxs then manualy copied using xcopy as per cougar694u (Thank You).Finally when booting from windows 7 CD my c: drive becomes G:.So giving commands as "mklink /J c:windowswinsxs d:windowswinsxs" did not work system rebooted continuosly nothing worked no safe/command prompt/repair mode eveything failed.Another mistake I made was just after xcopy i deleted using "rmdir /s/q c:windowswinsxs.moved" so there was no way to go back.

Ajay December 27, 2010 at 12:13 pm

Finally since everything was nicely moved to d: using xcopy c:windowswinsxs.moved d:windowswinsxs /h/i/c/k/e/y/x
Another problem was i could see a link in c: which was incorrect i just deleted it , then again “movefile c:windowswinsxs“ last thing to be done is create the link using “mklink /J c:windowswinsxs d:windowswinsxs“.
Wow and its all done the BSOD is gone and the system is running perfectly i did it bcoz i had only 70MB left on my c: drive did not want to reinstall or change partition size this really works but do it when u have the time to back up your important stuff from c drive dont be in a hurry like me but it really works that the best part 🙂

Will July 28, 2011 at 1:21 am

I highly advise against moving the winsxs folder. I attempted the method described here, only to be met with a BSOD in the middle of the proccess (yes, I verified the pendingmoves were correct before restarting). Luckily I had my installation CD on hand, and simply renamed the link to “winsxs.old” and renamed “winsxs.moved” back to “winsxs”. When doing this, I advise against deleting the hard-junction link. I’m not sure if windows explorer/command prompt will simply delete the link, or delete what the link points to (in this case, the contents of the old winsxs folder). Since the winsxs folder is updated as you install applications, there’s no way to get a proper replacement once the old one is deleted. Although the installation disk contains a winsxs folder in it’s windows directory, that’s a barebones folder. It won’t solve your problems.

Either way, the winsxs folder is not as large as it appears inside Windows Explorer/Windirstat. It’s mostly made up of hard-links (the same links we dealt with in this tutorial), which unfortunately, Explorer/Windirstat perceive as actual files. While the folder appears to be in the 10GB range, in reality it’s more like 1GB of actual data. The rest is just links tricking explorer into thinking there are actually hundreds of thousands of files in the folder.

Torsten Reichert September 14, 2011 at 6:43 am

This does not work, when you use encrypted file systems – tools like PGP desktop – because the drivers are not loaded yet, when movefile tries to access the filesystem.
You get bluescreens on boot.
Simplest remedy is:
Connect the harddisk to another machine (de/encryption software installed of course) and undo the change.

Torsten Reichert September 14, 2011 at 6:46 am

By the way. For those without encrypted filesystem here is a sketch of a batchfile helping you to do the job:

Put this somewhere like in c:\mvwinsxs.bat, so get a clue immediately see, if you do not have administrator priviligues.

@echo off
    echo SOURCE:
    echo This must be an administrator command prompt !
    rmdir /S/Q c:\windows\system\testadmin
    mkdir c:\windows\system\testadmin
    if errorlevel 1 goto Err4NoAdmin
    rmdir /S/Q c:\windows\system\testadmin
    if errorlevel 1 goto Err4NoAdmin

    if exist c:\mvwinsxs.d goto PhaseDbg
    if exist c:\mvwinsxs.1 goto Phase2
    if exist c:\mvwinsxs.2 goto Phase3

    echo 1) In Windows Explorer navigate to the \Windows\WinSXS directory.
    echo 2) Right click the directory to bring up the quick menu and select Properties.
    echo 3) Click the Security tab to view the security properties. You will need to assign the Administrator user account ownership of the directory and then
    echo 4) grant the Administrators group Full Access.
    echo mklink /J c:\windows\ winsxs.moved
    mkdir c:\windows\winsxs.moved
    mklink /J c:\windows\ winsxs.moved
    if errorlevel 1 goto Err4mklink

    rmdir /S/Q c:\windows\winsxs.moved
    echo movefile c:\windows\winsxs c:\windows\winsxs.moved
    movefile c:\windows\winsxs c:\windows\winsxs.moved
    if errorlevel 1 goto Err4rmdir

    echo movefile c:\windows\ c:\windows\winsxs
    movefile c:\windows\ c:\windows\winsxs
    if errorlevel 1 goto Err4movefile

    echo It will show the two pending moves you’ve entered above, with NO ERRORS. If it all looks good, REBOOT!
    echo On reboot the critical renames/moves will execute, and the WinSxS directory will be unlocked and able to be moved in the next steps.
    echo "OK" > c:\mvwinsxs.1
    goto Exit

    dir c:\windows\winsxs*
    echo If you performed the previous steps correctly, you’ll see a WinSxS.moved directory and the WinSxS junction.  If it did not work, repeat the above steps.

    echo Our next step is to relocate the WinSXS directory and amend the junction.
    mkdir d:\windows
    xcopy c:\windows\winsxs d:\windows\ /E/C/I/G/H/R/K/O/X/Y
    if errorlevel 1 goto Err4xcopy

    ren d:\windows\WinSxS.moved d:\windows\WinSxS

    echo Attention: Verify d:\windows\WinSxS is correct ! rmdir c:\windows\winsxs will be executet now !
    rmdir /S/Q c:\windows\winsxs
    mklink /J c:\windows\winsxs d:\windows\winsxs
    dir c:\windows\winsxs
    echo You should see all the files. (Even though they are actually on your other partition or drive)
    echo If so: Reboot !
    echo After reboot, you should be able to delete c:\windows\winsxs.moved and FINALLY liberate all that disk space.
    del c:\mvwinsxs.1
    echo "OK" > c:\mvwinsxs.2
    goto Exit

    rmdir /S/Q c:\windows\winsxs.moved
    echo Whew! Now take a bow.
    del c:\mvwinsxs.2
    goto Exit

REM hooks for error handling

    echo This script must be run at a dos-commandline with administrators priviligues.
goto Exit

    echo Correct error.
goto Exit

    echo Correct error: Make a full copy !
    echo Using Windows Explorer, COPY the entire WinSxS.moved directory to a \Windows directory on another partition or drive.
goto Exit


Jim Solar December 13, 2011 at 11:00 pm

With SSD drives becoming so popular, and Windows 7 Professional getting fatter by the second, someone needs to make an application to move these disk hogging folders. I read a post where someone said, but 1TB SATA drives are cheap as dirt, well yeah, but they are slow as molasses when running Win 7 and 2 or 3 Autodesk programs compared to an SSD drive. It will be a while before SSDs approach 500GB, and they will be prohibitively expensive.

I don’t understand why this should be so difficult…and dangerous. If you make a mistake, your are in deep trouble! Is the SSD manufacturing community listening? Is anybody listening? We need Windows 7 Optimization Utilities everyone can use and understand. Not all this command line hocus pocus! My 90GB OCZ SSD has a huge winsxs folder, and software distribution folder, and hotfix folders, and paging file etc. Get them off of there and onto my 500GB SATA d: Drive. That’s why I bought it, for data, and excess Win 7 stuff.

These are great posts, and exactly what I am looking for, but I’m chicken. I use Autodesk programs, lots of them, and I need all the performance I can get. If I were to screw up, my boss would have my head. Speaking of Autodesk, they are just as bad as MS in the excessive files categories. At least many of their directories can be moved a little easier, and less risk.

DjGrazzy May 2, 2013 at 10:55 pm

Anyone able to achieve this on Windows 8 yet?