Move Public Folder out of C:\Users

0

I would like to clean up the C:\Users directory with a batch script unfortunately this script is also deleting the Public what i would like to keep there, so I've thought i can move the Public folder out of C:\Users then run the batch script and when this is finished move the Public folder back. But when i try to move the Public folder out with this command:

move C:\Users\Public C:\tmp\Public

it says me Access denied.

I hope someone can help me.

-tmrbng

tmrbng

Posted 2017-07-07T13:27:36.947

Reputation: 9

You need to be running as administrator in order to do this. – AFH – 2017-07-07T13:46:23.900

Is it easier to move the Public folder twice, or to exclude it in the script? Presumably you're already excluding your account directory. – Jay – 2017-07-07T14:21:08.887

1In order to do this the correct way, you would have to change the location of the default profile, when the image of your installation is built. This would require you to install Windows, move the location of the Public profile, then build a .wim image. This isn't for the inexperienced and it cannot easily be done after Windows is installed. – Ramhound – 2017-07-07T15:01:03.033

Answers

0

I agree with @Jay's comment.

This small batch will list Users profiles except All Users, Default, Public and the current User.

@Echo off
For /F "delims=" %%A in (
  'dir /B/AD "%USERPROFILE%\.." ^|findstr /IV "^All ^Default ^Public ^%USERPROFILE:*Users\=%$"'
) Do (
  Echo current profile folder name: %%A
  Rem do with it whatever you like
)

IMO an even better approach would be to use WinDirStat to see who/what is the space hog and work through the biggest ones.

LotPings

Posted 2017-07-07T13:27:36.947

Reputation: 6 150