參考文檔
- https://www.cnblogs.com/pengpengboshi/p/14139581.html
- https://ld246.com/article/1599457575130
- https://blog.csdn.net/a772304419/article/details/114691137
我采用了第二種,通過在安裝win10系統時進行操作,簡要說下操作步驟
安裝 Win10
當 windows 連接到網絡的時候有時 Sysprep 會失敗,所以建議在進入 Audit Mode 之前,全程關閉網絡連接
安裝上 windows,重啟電腦之后,當進入區域選擇界面時,按下 Ctrl Shift F3
,這時 windows 會重啟,進入 Audit Mode,然后顯示一個 System Preparation Tool
,將它關閉。
新建一個 unattended answer file
現在你就可以將電腦連接到網絡了。
接下來我們要使用 System Preparation Tool
(Sysprep) 工具來設置用戶路徑。這個工具會執行一個 xml 文件中的配置(也就是 unattended answer file
)
我們現在只需要一個非常簡單的 answer file,只需包含以下內容:
windows 的版本(32 或 64 bit)
- 用戶文件夾的新路徑(例如 M:/Users)
- 現在打開 Notepad,將下列代碼粘貼進去:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FolderLocations>
<ProfilesDirectory>M:\Users</ProfilesDirectory>
</FolderLocations>
</component>
</settings>
</unattend>
請按照需要修改上述代碼,但是一定注意里面的amd64
和M:\Users
根據自己實際情況進行調整。
警告,繼續操作之前,先讀一下這個:
Windows 以字母來標識盤符,但是當安裝了 windows 重啟之后,本來你想把用戶目錄安裝到 M 盤,但這個盤符可能不存在或發生改變,比如變成了 f 盤,這個時候就會失敗。
所以為了保證你的 M 盤盤符不變,你需要給他手動設置一下盤符,在 Audit Mode 你可以使用磁盤管理工具,手動的將 f 盤改成 M 盤。
將這個 xml 文件保存到磁盤根目錄(不能是 C 盤),例如我把它保存到了:D:\relocate.xml
運行 Sysprep
以管理員模式運行 cmd ,首先,確保 WMP Network Sharing Service 已停止運行:
net stop wmpnetworksvc
然后運行然下后列運命:
%windir%\system32\sysprep\sysprep.exe /oobe /reboot /unattend:d:\relocate.xml
特別注意:這里的命令中的d:\relocate.xml
是將relocate.xml放在了D盤根目錄,請根據具體情況做相應調整再執行
上述命令告訴系統從 Windows\System32\Sysprep
運行 Sysprep,執行D:/relocate.xml
中的指令,為 OOBE(the firlst boot of newly installed Windows)
重啟准備系統,最后重啟。
然后就繼續安裝配置系統,之后你所有的新用戶都會在 M:/Users 這個目錄下新建。