;------------------------------------------------ #include #include #include #include #include #include #include #include ;------------------------------------------------ ;relocate_user_folders ;Updated script by ioa747...with gratitude! ;Last updated: 7:21 AM 12/9/2023 ;Last confirmed: 9:50 AM 12/9/2023 ;------------------------------------------------ _CopyUserFolders() _RegFolderRedirection() _CopyIniFilesE() _CopyIniFilesF() _CleanupOldFolders() _UpdateFoldersIcons() _RestartComputer() ;------------------------------------------------ Func _CopyUserFolders() Local $sSrcDataE = "D:\Install\System_Config\Folders\Source_Data_E" Local $sSrcDataF = "D:\Install\System_Config\Folders\Source_Data_F" Local $sSrcDataG = "D:\Install\System_Config\Folders\Source_Data_G" Local $sDstDataE = "E:\" Local $sDstDataF = "F:\" Local $sDstDataG = "G:\" ;------------------ SplashTextOn("Notice!", "Copying User System Folders...", 350, 50, -1, -1) Sleep(2000) ;------------------ DirCopy($sSrcDataE, $sDstDataE, $FC_OVERWRITE) DirCopy($sSrcDataF, $sDstDataF, $FC_OVERWRITE) DirCopy($sSrcDataG, $sDstDataG, $FC_OVERWRITE) ;------------------ SplashTextOn("Notice!", "Copying User System Folders completed...", 350, 50, -1, -1) Sleep(3000) EndFunc ;==>_CopyUserFolders ;------------------------------------------------ Func _RegFolderRedirection() ;Configuring the required variables for use when applying folder redirection in the registry. Local $sNewDesktop = "E:\Desktop" Local $sNewDocuments = "E:\Text" Local $sNewDownloads = "E:\Downloads" Local $sNewMusic = "F:\Audio" Local $sNewPictures = "E:\Images" Local $sNewVideos = "E:\Video" ;------------------ Local $sRegistryPath1 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" Local $sRegistryPath2 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" ;------------------ SplashTextOn("Notice!", "Begin folder redirection in the Registry...", 350, 50, -1, -1) Sleep(2000) ;------------------ ;Updating the specified registry keys. RegWrite($sRegistryPath1, "Desktop", "REG_SZ", $sNewDesktop) RegWrite($sRegistryPath1, "Personal", "REG_SZ", $sNewDocuments) RegWrite($sRegistryPath1, "Downloads", "REG_SZ", $sNewDownloads) RegWrite($sRegistryPath1, "My Music", "REG_SZ", $sNewMusic) RegWrite($sRegistryPath1, "My Pictures", "REG_SZ", $sNewPictures) RegWrite($sRegistryPath1, "My Video", "REG_SZ", $sNewVideos) ;------------------ RegWrite($sRegistryPath2, "Desktop", "REG_EXPAND_SZ", $sNewDesktop) RegWrite($sRegistryPath2, "Personal", "REG_EXPAND_SZ", $sNewDocuments) RegWrite($sRegistryPath2, "Downloads", "REG_EXPAND_SZ", $sNewDownloads) RegWrite($sRegistryPath2, "My Music", "REG_EXPAND_SZ", $sNewMusic) RegWrite($sRegistryPath2, "My Pictures", "REG_EXPAND_SZ", $sNewPictures) RegWrite($sRegistryPath2, "My Video", "REG_EXPAND_SZ", $sNewVideos) ;------------------ RegWrite($sRegistryPath2, "{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}", "REG_EXPAND_SZ", $sNewDesktop) RegWrite($sRegistryPath2, "{F42EE2D3-909F-4907-8871-4C22FC0BF756}", "REG_EXPAND_SZ", $sNewDocuments) RegWrite($sRegistryPath2, "{374DE290-123F-4565-9164-39C4925E467B}", "REG_EXPAND_SZ", $sNewDownloads) RegWrite($sRegistryPath2, "{A0C69A99-21C8-4671-8703-7934162FCF1D}", "REG_EXPAND_SZ", $sNewMusic) RegWrite($sRegistryPath2, "{0DDD015D-B06C-45D5-8C4C-F59713854639}", "REG_EXPAND_SZ", $sNewPictures) RegWrite($sRegistryPath2, "{35286A68-3C57-41A1-BBB1-0EAE73D76C95}", "REG_EXPAND_SZ", $sNewVideos) ;------------------ SplashTextOn("Notice!", "Folder redirection in the Registry completed...", 350, 50, -1, -1) Sleep(3000) EndFunc ;==>_RegFolderRedirection ;------------------------------------------------ Func _CopyIniFilesE() ;Copy (desktop.ini) files (Folder icon fix) ;Updated script by ioa747...with gratitude! Local $sOldPath = "D:\Install\System_Config\ini_files\E\" Local $sNewPath = "E:\" Local $sFolder ;------------------ SplashTextOn("Notice!", "Copying [E] .ini files...", 350, 50, -1, -1) Sleep(2000) ;------------------ $ArraySrtfiles = _FileListToArrayRec($sOldPath, "desktop.ini", $FLTAR_FILES, $FLTAR_RECUR) For $x = 1 To $ArraySrtfiles[0] FileCopy($sOldPath & $ArraySrtfiles[$x], $sNewPath & $ArraySrtfiles[$x], 1) $sFolder = StringLeft($sNewPath & $ArraySrtfiles[$x], StringInStr($sNewPath & $ArraySrtfiles[$x], '\', 0, -1)) FileSetAttrib($sFolder, "+R") Next ;------------------ SplashTextOn("Notice!", "Copying [E] .ini files completed...", 350, 50, -1, -1) Sleep(3000) EndFunc ;==>_CopyIniFilesE ;------------------------------------------------ Func _CopyIniFilesF() ;Copy (desktop.ini) files (Folder icon fix) ;Updated script by ioa747...with gratitude! Local $sOldPath = "D:\Install\System_Config\ini_files\F\" Local $sNewPath = "F:\" Local $sFolder ;------------------ SplashTextOn("Notice!", "Copying [F] .ini files...", 350, 50, -1, -1) Sleep(2000) ;------------------ $ArraySrtfiles = _FileListToArrayRec($sOldPath, "desktop.ini", $FLTAR_FILES, $FLTAR_RECUR) For $x = 1 To $ArraySrtfiles[0] FileCopy($sOldPath & $ArraySrtfiles[$x], $sNewPath & $ArraySrtfiles[$x], 1) $sFolder = StringLeft($sNewPath & $ArraySrtfiles[$x], StringInStr($sNewPath & $ArraySrtfiles[$x], '\', 0, -1)) FileSetAttrib($sFolder, "+R") Next ;------------------ SplashTextOn("Notice!", "Copying [F] .ini files completed...", 350, 50, -1, -1) Sleep(3000) EndFunc ;==>_CopyIniFilesF ;------------------------------------------------ Func _CleanupOldFolders() ;Clean old user folders. ;Updated script by ioa747...with gratitude! Local $sOldPath = "C:\Users\RML_User" Local $aFolders = "Desktop, Documents, Downloads, Favorites, Music, Pictures, Videos" ;------------------ $aFolders = StringSplit($aFolders, ", ", 1) ;------------------ SplashTextOn("Notice!", "Removing existing User system folders...", 350, 50, -1, -1) Sleep(2000) ;------------------ For $i = 1 To $aFolders[0] DirRemove($sOldPath & "\" & $aFolders[$i], $DIR_REMOVE) Next ;------------------ SplashTextOn("Notice!", "Removing existing User system folders completed...", 450, 50, -1, -1) Sleep(3000) EndFunc ;==>_CleanupOldFolders ;------------------------------------------------ Func _UpdateFoldersIcons() ;Update folder icons... Local $sRegistryPath1 = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon" Local $sRegistryPath2 = "HKEY_CLASSES_ROOT\cmdfile\DefaultIcon" Local $sRegistryPath3 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" ;------------------ Local $IconValue1 = "D:\Install\System_Config\Icons\computer.ico" Local $IconValue2 = "D:\Install\System_Config\Icons\command.ico" Local $IconValue3 = "D:\Install\System_Config\Icons\folder.ico" ;------------------ SplashTextOn("Notice!", "Updating folder icons...", 350, 50, -1, -1) Sleep(2000) ;------------------ RegWrite($sRegistryPath1, "(Default)", "REG_SZ", $IconValue1) RegWrite($sRegistryPath2, "(Default)", "REG_EXPAND_SZ", $IconValue2) RegWrite($sRegistryPath3, "(3)", "REG_SZ", $IconValue3) RegWrite($sRegistryPath3, "(4)", "REG_SZ", $IconValue3) ;------------------ SplashTextOn("Notice!", "Updating folder icons completed...", 350, 50, -1, -1) Sleep(3000) EndFunc ;==>_UpdateFoldersIcons Func _RestartComputer() Shutdown(2) EndFunc ;==>_RestartComputer ;------------------------------------------------