Browse Source

Improved Set-UserShellFolderLocation function. @lowl1f3

Added link to comments
pull/469/head
Dmitry Nefedov 2 years ago
parent
commit
675f2de4f2
  1. 2
      Wrapper/Config/config_Windows_10.json
  2. 2
      Wrapper/Config/config_Windows_10_LTSC.json
  3. 2
      Wrapper/Config/config_Windows_11.json
  4. 2
      Wrapper/Localizations/de-DE/tooltip_Windows_10.json
  5. 2
      Wrapper/Localizations/de-DE/tooltip_Windows_11.json
  6. 4
      Wrapper/Localizations/en-US/tooltip_Windows_10.json
  7. 4
      Wrapper/Localizations/en-US/tooltip_Windows_11.json
  8. 2
      Wrapper/Localizations/ru-RU/tooltip_Windows_10.json
  9. 2
      Wrapper/Localizations/ru-RU/tooltip_Windows_11.json
  10. 207
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  11. 8
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  12. 207
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  13. 8
      src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
  14. 207
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  15. 8
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  16. 207
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  17. 8
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  18. 207
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  19. 8
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  20. 207
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  21. 8
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

2
Wrapper/Config/config_Windows_10.json

@ -1371,7 +1371,7 @@
"Region": "System", "Region": "System",
"Control": "cmb", "Control": "cmb",
"Required": "false", "Required": "false",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root" "Tag": "Root"

2
Wrapper/Config/config_Windows_10_LTSC.json

@ -1507,7 +1507,7 @@
"Region": "System", "Region": "System",
"Control": "cmb", "Control": "cmb",
"Required": "false", "Required": "false",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root" "Tag": "Root"

2
Wrapper/Config/config_Windows_11.json

@ -1251,7 +1251,7 @@
"Region": "System", "Region": "System",
"Control": "cmb", "Control": "cmb",
"Required": "false", "Required": "false",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root" "Tag": "Root"

2
Wrapper/Localizations/de-DE/tooltip_Windows_10.json

@ -1226,7 +1226,7 @@
{ {
"Id": 520, "Id": 520,
"Region": "System", "Region": "System",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root", "Tag": "Root",

2
Wrapper/Localizations/de-DE/tooltip_Windows_11.json

@ -1121,7 +1121,7 @@
{ {
"Id": 520, "Id": 520,
"Region": "System", "Region": "System",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root", "Tag": "Root",

4
Wrapper/Localizations/en-US/tooltip_Windows_10.json

@ -1226,11 +1226,11 @@
{ {
"Id": 520, "Id": 520,
"Region": "System", "Region": "System",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root", "Tag": "Root",
"ToolTip": "Move user folders location to the root of any drive using the interactive menu. User files or folders won't me moved to a new location. Move them manually. They're located in the %USERPROFILE% folder by default" "ToolTip": "Change user folders location to the root of any drive using the interactive menu. User files or folders won't me moved to a new location. Move them manually. They're located in the %USERPROFILE% folder by default"
}, },
"One": { "One": {
"Tag": "Custom", "Tag": "Custom",

4
Wrapper/Localizations/en-US/tooltip_Windows_11.json

@ -1121,11 +1121,11 @@
{ {
"Id": 520, "Id": 520,
"Region": "System", "Region": "System",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root", "Tag": "Root",
"ToolTip": "Move user folders location to the root of any drive using the interactive menu. User files or folders won't me moved to a new location. Move them manually. They're located in the %USERPROFILE% folder by default" "ToolTip": "Change user folders location to the root of any drive using the interactive menu. User files or folders won't me moved to a new location. Move them manually. They're located in the %USERPROFILE% folder by default"
}, },
"One": { "One": {
"Tag": "Custom", "Tag": "Custom",

2
Wrapper/Localizations/ru-RU/tooltip_Windows_10.json

@ -1226,7 +1226,7 @@
{ {
"Id": 520, "Id": 520,
"Region": "System", "Region": "System",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root", "Tag": "Root",

2
Wrapper/Localizations/ru-RU/tooltip_Windows_11.json

@ -1136,7 +1136,7 @@
{ {
"Id": 520, "Id": 520,
"Region": "System", "Region": "System",
"Function": "SetUserShellFolderLocation", "Function": "Set-UserShellFolderLocation",
"Arg": { "Arg": {
"Zero": { "Zero": {
"Tag": "Root", "Tag": "Root",

207
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -6658,10 +6658,10 @@ function InputMethod
<# <#
.SYNOPSIS .SYNOPSIS
User folders location Change User folders location
.PARAMETER Root .PARAMETER Root
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
.PARAMETER Custom .PARAMETER Custom
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -6670,13 +6670,13 @@ function InputMethod
Change user folders location to the default values Change user folders location to the default values
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Custom Set-UserShellFolderLocation -Custom
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Default Set-UserShellFolderLocation -Default
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
@ -6684,7 +6684,7 @@ function InputMethod
.NOTES .NOTES
Current user Current user
#> #>
function SetUserShellFolderLocation function Set-UserShellFolderLocation
{ {
param param
@ -6719,7 +6719,7 @@ function SetUserShellFolderLocation
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder The RemoveDesktopINI argument removes desktop.ini in the old user shell folder
.EXAMPLE .EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI
.LINK .LINK
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath
@ -6727,7 +6727,7 @@ function SetUserShellFolderLocation
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
#> #>
function UserShellFolder function Set-UserShellFolder
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6751,9 +6751,9 @@ function SetUserShellFolderLocation
Redirect user folders to a new location Redirect user folders to a new location
.EXAMPLE .EXAMPLE
KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop" Set-KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop"
#> #>
function KnownFolderPath function Set-KnownFolderPath
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6872,7 +6872,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding # Save desktop.ini in the UTF-16 LE encoding
@ -6999,26 +6999,22 @@ public static string GetString(uint strId)
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
# Store all drives letters to use them within ShowMenu function # Store all fixed disks' letters to use them within ShowMenu function
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) # https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# If the number of disks is more than one, set the second drive in the list as default drive # If the number of disks is more than one, set the second drive in the list as default drive
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
$Script:Default = 1 $Script:Default = 1
} }
else
{
$Script:Default = 0
}
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7033,23 +7029,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7064,23 +7065,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DocumentsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7095,23 +7101,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DownloadsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7126,23 +7137,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $MusicLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7157,23 +7173,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $PicturesLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7188,12 +7209,18 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $VideosLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -7201,10 +7228,10 @@ public static string GetString(uint strId)
"Custom" "Custom"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7230,22 +7257,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7271,22 +7297,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7312,22 +7337,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7353,22 +7377,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7394,22 +7417,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7435,13 +7457,12 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -7449,10 +7470,10 @@ public static string GetString(uint strId)
"Default" "Default"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7467,20 +7488,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7495,20 +7515,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7523,20 +7542,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
Write-Information -MessageData "" -InformationAction Continue
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7551,20 +7569,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7579,24 +7596,21 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue
$Title = "" $Title = ""
$Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString
$Yes = $Localization.Yes $Yes = $Localization.Yes
@ -7609,11 +7623,10 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }

8
src/Sophia_Script_for_Windows_10/Sophia.ps1

@ -779,7 +779,7 @@ InputMethod -English
# InputMethod -Default # InputMethod -Default
<# <#
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
User files or folders won't me moved to a new location. Move them manually User files or folders won't me moved to a new location. Move them manually
They're located in the %USERPROFILE% folder by default They're located in the %USERPROFILE% folder by default
@ -787,7 +787,7 @@ InputMethod -English
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
<# <#
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -798,7 +798,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Custom # Set-UserShellFolderLocation -Custom
<# <#
Change user folders location to the default values Change user folders location to the default values
@ -809,7 +809,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Default # Set-UserShellFolderLocation -Default
# Use the latest installed .NET runtime for all apps # Use the latest installed .NET runtime for all apps
# Использовать последнюю установленную среду выполнения .NET для всех приложений # Использовать последнюю установленную среду выполнения .NET для всех приложений

207
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -5317,10 +5317,10 @@ function InputMethod
<# <#
.SYNOPSIS .SYNOPSIS
User folders location Change User folders location
.PARAMETER Root .PARAMETER Root
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
.PARAMETER Custom .PARAMETER Custom
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -5329,13 +5329,13 @@ function InputMethod
Change user folders location to the default values Change user folders location to the default values
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Custom Set-UserShellFolderLocation -Custom
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Default Set-UserShellFolderLocation -Default
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
@ -5343,7 +5343,7 @@ function InputMethod
.NOTES .NOTES
Current user Current user
#> #>
function SetUserShellFolderLocation function Set-UserShellFolderLocation
{ {
param param
@ -5378,7 +5378,7 @@ function SetUserShellFolderLocation
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder The RemoveDesktopINI argument removes desktop.ini in the old user shell folder
.EXAMPLE .EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI
.LINK .LINK
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath
@ -5386,7 +5386,7 @@ function SetUserShellFolderLocation
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
#> #>
function UserShellFolder function Set-UserShellFolder
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -5410,9 +5410,9 @@ function SetUserShellFolderLocation
Redirect user folders to a new location Redirect user folders to a new location
.EXAMPLE .EXAMPLE
KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop" Set-KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop"
#> #>
function KnownFolderPath function Set-KnownFolderPath
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -5531,7 +5531,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding # Save desktop.ini in the UTF-16 LE encoding
@ -5658,26 +5658,22 @@ public static string GetString(uint strId)
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
# Store all drives letters to use them within ShowMenu function # Store all fixed disks' letters to use them within ShowMenu function
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) # https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# If the number of disks is more than one, set the second drive in the list as default drive # If the number of disks is more than one, set the second drive in the list as default drive
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
$Script:Default = 1 $Script:Default = 1
} }
else
{
$Script:Default = 0
}
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5692,23 +5688,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5723,23 +5724,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DocumentsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5754,23 +5760,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DownloadsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5785,23 +5796,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $MusicLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5816,23 +5832,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $PicturesLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5847,12 +5868,18 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $VideosLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -5860,10 +5887,10 @@ public static string GetString(uint strId)
"Custom" "Custom"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5889,22 +5916,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5930,22 +5956,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -5971,22 +5996,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6012,22 +6036,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6053,22 +6076,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6094,13 +6116,12 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -6108,10 +6129,10 @@ public static string GetString(uint strId)
"Default" "Default"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6126,20 +6147,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6154,20 +6174,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6182,20 +6201,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
Write-Information -MessageData "" -InformationAction Continue
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6210,20 +6228,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6238,24 +6255,21 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue
$Title = "" $Title = ""
$Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString
$Yes = $Localization.Yes $Yes = $Localization.Yes
@ -6268,11 +6282,10 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }

8
src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1

@ -637,7 +637,7 @@ InputMethod -English
# InputMethod -Default # InputMethod -Default
<# <#
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
User files or folders won't me moved to a new location. Move them manually User files or folders won't me moved to a new location. Move them manually
They're located in the %USERPROFILE% folder by default They're located in the %USERPROFILE% folder by default
@ -645,7 +645,7 @@ InputMethod -English
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
<# <#
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -656,7 +656,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Custom # Set-UserShellFolderLocation -Custom
<# <#
Change user folders location to the default values Change user folders location to the default values
@ -667,7 +667,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Default # Set-UserShellFolderLocation -Default
# Use the latest installed .NET runtime for all apps # Use the latest installed .NET runtime for all apps
# Использовать последнюю установленную среду выполнения .NET для всех приложений # Использовать последнюю установленную среду выполнения .NET для всех приложений

207
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -5704,10 +5704,10 @@ function InputMethod
<# <#
.SYNOPSIS .SYNOPSIS
User folders location Change User folders location
.PARAMETER Root .PARAMETER Root
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
.PARAMETER Custom .PARAMETER Custom
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -5716,13 +5716,13 @@ function InputMethod
Change user folders location to the default values Change user folders location to the default values
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Custom Set-UserShellFolderLocation -Custom
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Default Set-UserShellFolderLocation -Default
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
@ -5730,7 +5730,7 @@ function InputMethod
.NOTES .NOTES
Current user Current user
#> #>
function SetUserShellFolderLocation function Set-UserShellFolderLocation
{ {
param param
@ -5765,7 +5765,7 @@ function SetUserShellFolderLocation
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder The RemoveDesktopINI argument removes desktop.ini in the old user shell folder
.EXAMPLE .EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI
.LINK .LINK
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath
@ -5773,7 +5773,7 @@ function SetUserShellFolderLocation
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
#> #>
function UserShellFolder function Set-UserShellFolder
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -5797,9 +5797,9 @@ function SetUserShellFolderLocation
Redirect user folders to a new location Redirect user folders to a new location
.EXAMPLE .EXAMPLE
KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop" Set-KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop"
#> #>
function KnownFolderPath function Set-KnownFolderPath
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -5918,7 +5918,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding # Save desktop.ini in the UTF-16 LE encoding
@ -6045,26 +6045,22 @@ public static string GetString(uint strId)
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
# Store all drives letters to use them within ShowMenu function # Store all fixed disks' letters to use them within ShowMenu function
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) # https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# If the number of disks is more than one, set the second drive in the list as default drive # If the number of disks is more than one, set the second drive in the list as default drive
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
$Script:Default = 1 $Script:Default = 1
} }
else
{
$Script:Default = 0
}
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6079,23 +6075,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6110,23 +6111,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DocumentsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6141,23 +6147,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DownloadsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6172,23 +6183,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $MusicLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6203,23 +6219,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $PicturesLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6234,12 +6255,18 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $VideosLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -6247,10 +6274,10 @@ public static string GetString(uint strId)
"Custom" "Custom"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6276,22 +6303,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6317,22 +6343,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6358,22 +6383,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6399,22 +6423,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6440,22 +6463,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6481,13 +6503,12 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -6495,10 +6516,10 @@ public static string GetString(uint strId)
"Default" "Default"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6513,20 +6534,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6541,20 +6561,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6569,20 +6588,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
Write-Information -MessageData "" -InformationAction Continue
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6597,20 +6615,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6625,24 +6642,21 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue
$Title = "" $Title = ""
$Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString
$Yes = $Localization.Yes $Yes = $Localization.Yes
@ -6655,11 +6669,10 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }

8
src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1

@ -692,7 +692,7 @@ InputMethod -English
# InputMethod -Default # InputMethod -Default
<# <#
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
User files or folders won't me moved to a new location. Move them manually User files or folders won't me moved to a new location. Move them manually
They're located in the %USERPROFILE% folder by default They're located in the %USERPROFILE% folder by default
@ -700,7 +700,7 @@ InputMethod -English
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
<# <#
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -711,7 +711,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Custom # Set-UserShellFolderLocation -Custom
<# <#
Change user folders location to the default values Change user folders location to the default values
@ -722,7 +722,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Default # Set-UserShellFolderLocation -Default
# Use the latest installed .NET runtime for all apps # Use the latest installed .NET runtime for all apps
# Использовать последнюю установленную среду выполнения .NET для всех приложений # Использовать последнюю установленную среду выполнения .NET для всех приложений

207
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -6661,10 +6661,10 @@ function InputMethod
<# <#
.SYNOPSIS .SYNOPSIS
User folders location Change User folders location
.PARAMETER Root .PARAMETER Root
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
.PARAMETER Custom .PARAMETER Custom
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -6673,13 +6673,13 @@ function InputMethod
Change user folders location to the default values Change user folders location to the default values
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Custom Set-UserShellFolderLocation -Custom
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Default Set-UserShellFolderLocation -Default
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
@ -6687,7 +6687,7 @@ function InputMethod
.NOTES .NOTES
Current user Current user
#> #>
function SetUserShellFolderLocation function Set-UserShellFolderLocation
{ {
param param
@ -6722,7 +6722,7 @@ function SetUserShellFolderLocation
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder The RemoveDesktopINI argument removes desktop.ini in the old user shell folder
.EXAMPLE .EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI
.LINK .LINK
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath
@ -6730,7 +6730,7 @@ function SetUserShellFolderLocation
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
#> #>
function UserShellFolder function Set-UserShellFolder
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6754,9 +6754,9 @@ function SetUserShellFolderLocation
Redirect user folders to a new location Redirect user folders to a new location
.EXAMPLE .EXAMPLE
KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop" Set-KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop"
#> #>
function KnownFolderPath function Set-KnownFolderPath
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6875,7 +6875,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding # Save desktop.ini in the UTF-16 LE encoding
@ -7002,26 +7002,22 @@ public static string GetString(uint strId)
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
# Store all drives letters to use them within ShowMenu function # Store all fixed disks' letters to use them within ShowMenu function
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) # https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# If the number of disks is more than one, set the second drive in the list as default drive # If the number of disks is more than one, set the second drive in the list as default drive
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
$Script:Default = 1 $Script:Default = 1
} }
else
{
$Script:Default = 0
}
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7036,23 +7032,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7067,23 +7068,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DocumentsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7098,23 +7104,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DownloadsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7129,23 +7140,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $MusicLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7160,23 +7176,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $PicturesLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7191,12 +7212,18 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $VideosLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -7204,10 +7231,10 @@ public static string GetString(uint strId)
"Custom" "Custom"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7233,22 +7260,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7274,22 +7300,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7315,22 +7340,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7356,22 +7380,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7397,22 +7420,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7438,13 +7460,12 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -7452,10 +7473,10 @@ public static string GetString(uint strId)
"Default" "Default"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7470,20 +7491,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7498,20 +7518,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7526,20 +7545,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
Write-Information -MessageData "" -InformationAction Continue
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7554,20 +7572,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7582,24 +7599,21 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue
$Title = "" $Title = ""
$Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString
$Yes = $Localization.Yes $Yes = $Localization.Yes
@ -7612,11 +7626,10 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }

8
src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1

@ -788,7 +788,7 @@ InputMethod -English
# InputMethod -Default # InputMethod -Default
<# <#
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
User files or folders won't me moved to a new location. Move them manually User files or folders won't me moved to a new location. Move them manually
They're located in the %USERPROFILE% folder by default They're located in the %USERPROFILE% folder by default
@ -796,7 +796,7 @@ InputMethod -English
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
<# <#
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -807,7 +807,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Custom # Set-UserShellFolderLocation -Custom
<# <#
Change user folders location to the default values Change user folders location to the default values
@ -818,7 +818,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Default # Set-UserShellFolderLocation -Default
# Use the latest installed .NET runtime for all apps # Use the latest installed .NET runtime for all apps
# Использовать последнюю установленную среду выполнения .NET для всех приложений # Использовать последнюю установленную среду выполнения .NET для всех приложений

207
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -6231,10 +6231,10 @@ function InputMethod
<# <#
.SYNOPSIS .SYNOPSIS
User folders location Change User folders location
.PARAMETER Root .PARAMETER Root
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
.PARAMETER Custom .PARAMETER Custom
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -6243,13 +6243,13 @@ function InputMethod
Change user folders location to the default values Change user folders location to the default values
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Custom Set-UserShellFolderLocation -Custom
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Default Set-UserShellFolderLocation -Default
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
@ -6257,7 +6257,7 @@ function InputMethod
.NOTES .NOTES
Current user Current user
#> #>
function SetUserShellFolderLocation function Set-UserShellFolderLocation
{ {
param param
@ -6292,7 +6292,7 @@ function SetUserShellFolderLocation
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder The RemoveDesktopINI argument removes desktop.ini in the old user shell folder
.EXAMPLE .EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI
.LINK .LINK
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath
@ -6300,7 +6300,7 @@ function SetUserShellFolderLocation
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
#> #>
function UserShellFolder function Set-UserShellFolder
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6324,9 +6324,9 @@ function SetUserShellFolderLocation
Redirect user folders to a new location Redirect user folders to a new location
.EXAMPLE .EXAMPLE
KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop" Set-KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop"
#> #>
function KnownFolderPath function Set-KnownFolderPath
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6445,7 +6445,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding # Save desktop.ini in the UTF-16 LE encoding
@ -6572,26 +6572,22 @@ public static string GetString(uint strId)
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
# Store all drives letters to use them within ShowMenu function # Store all fixed disks' letters to use them within ShowMenu function
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) # https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# If the number of disks is more than one, set the second drive in the list as default drive # If the number of disks is more than one, set the second drive in the list as default drive
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
$Script:Default = 1 $Script:Default = 1
} }
else
{
$Script:Default = 0
}
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6606,23 +6602,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6637,23 +6638,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DocumentsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6668,23 +6674,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DownloadsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6699,23 +6710,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $MusicLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6730,23 +6746,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $PicturesLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6761,12 +6782,18 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $VideosLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -6774,10 +6801,10 @@ public static string GetString(uint strId)
"Custom" "Custom"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6803,22 +6830,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6844,22 +6870,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6885,22 +6910,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6926,22 +6950,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6967,22 +6990,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7008,13 +7030,12 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -7022,10 +7043,10 @@ public static string GetString(uint strId)
"Default" "Default"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7040,20 +7061,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7068,20 +7088,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7096,20 +7115,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
Write-Information -MessageData "" -InformationAction Continue
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7124,20 +7142,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7152,24 +7169,21 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue
$Title = "" $Title = ""
$Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString
$Yes = $Localization.Yes $Yes = $Localization.Yes
@ -7182,11 +7196,10 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }

8
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -726,7 +726,7 @@ InputMethod -English
# InputMethod -Default # InputMethod -Default
<# <#
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
User files or folders won't me moved to a new location. Move them manually User files or folders won't me moved to a new location. Move them manually
They're located in the %USERPROFILE% folder by default They're located in the %USERPROFILE% folder by default
@ -734,7 +734,7 @@ InputMethod -English
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
<# <#
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -745,7 +745,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Custom # Set-UserShellFolderLocation -Custom
<# <#
Change user folders location to the default values Change user folders location to the default values
@ -756,7 +756,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Default # Set-UserShellFolderLocation -Default
# Use the latest installed .NET runtime for all apps # Use the latest installed .NET runtime for all apps
# Использовать последнюю установленную среду выполнения .NET для всех приложений # Использовать последнюю установленную среду выполнения .NET для всех приложений

207
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -6231,10 +6231,10 @@ function InputMethod
<# <#
.SYNOPSIS .SYNOPSIS
User folders location Change User folders location
.PARAMETER Root .PARAMETER Root
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
.PARAMETER Custom .PARAMETER Custom
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -6243,13 +6243,13 @@ function InputMethod
Change user folders location to the default values Change user folders location to the default values
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Custom Set-UserShellFolderLocation -Custom
.EXAMPLE .EXAMPLE
SetUserShellFolderLocation -Default Set-UserShellFolderLocation -Default
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
@ -6257,7 +6257,7 @@ function InputMethod
.NOTES .NOTES
Current user Current user
#> #>
function SetUserShellFolderLocation function Set-UserShellFolderLocation
{ {
param param
@ -6292,7 +6292,7 @@ function SetUserShellFolderLocation
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder The RemoveDesktopINI argument removes desktop.ini in the old user shell folder
.EXAMPLE .EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI
.LINK .LINK
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath
@ -6300,7 +6300,7 @@ function SetUserShellFolderLocation
.NOTES .NOTES
User files or folders won't me moved to a new location User files or folders won't me moved to a new location
#> #>
function UserShellFolder function Set-UserShellFolder
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6324,9 +6324,9 @@ function SetUserShellFolderLocation
Redirect user folders to a new location Redirect user folders to a new location
.EXAMPLE .EXAMPLE
KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop" Set-KnownFolderPath -KnownFolder Desktop -Path "$env:SystemDrive:\Desktop"
#> #>
function KnownFolderPath function Set-KnownFolderPath
{ {
[CmdletBinding()] [CmdletBinding()]
param param
@ -6445,7 +6445,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding # Save desktop.ini in the UTF-16 LE encoding
@ -6572,26 +6572,22 @@ public static string GetString(uint strId)
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
# Store all drives letters to use them within ShowMenu function # Store all fixed disks' letters to use them within ShowMenu function
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) # https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# If the number of disks is more than one, set the second drive in the list as default drive # If the number of disks is more than one, set the second drive in the list as default drive
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
$Script:Default = 1 $Script:Default = 1
} }
else
{
$Script:Default = 0
}
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6606,23 +6602,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6637,23 +6638,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DocumentsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6668,23 +6674,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DownloadsLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6699,23 +6710,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $MusicLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6730,23 +6746,28 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $PicturesLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6761,12 +6782,18 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $VideosLocalizedString) -Menu $DriveLetters -Default $Script:Default if ($DriveLetters.Count -gt 1)
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos" -RemoveDesktopINI {
$SelectedDrive = ShowMenu -Title ($Localization.DriveSelect -f $DesktopLocalizedString) -Menu $DriveLetters -Default $Script:Default
}
else
{
$SelectedDrive = $env:SystemDrive
}
Set-UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -6774,10 +6801,10 @@ public static string GetString(uint strId)
"Custom" "Custom"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6803,22 +6830,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6844,22 +6870,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6885,22 +6910,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6926,22 +6950,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -6967,22 +6990,21 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7008,13 +7030,12 @@ public static string GetString(uint strId)
if ($FolderBrowserDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath -RemoveDesktopINI
Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose Write-Verbose -Message ($Localization.NewUserFolderLocation -f $FolderBrowserDialog.SelectedPath) -Verbose
} }
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -7022,10 +7043,10 @@ public static string GetString(uint strId)
"Default" "Default"
{ {
# Desktop # Desktop
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7040,20 +7061,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Documents # Documents
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7068,20 +7088,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Downloads # Downloads
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7096,20 +7115,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
Write-Information -MessageData "" -InformationAction Continue
} }
} }
# Music # Music
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7124,20 +7142,19 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Pictures # Pictures
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
$Title = "" $Title = ""
@ -7152,24 +7169,21 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
# Videos # Videos
Write-Information -MessageData "" -InformationAction Continue
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue
$Title = "" $Title = ""
$Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString
$Yes = $Localization.Yes $Yes = $Localization.Yes
@ -7182,11 +7196,10 @@ public static string GetString(uint strId)
{ {
"0" "0"
{ {
UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }

8
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -735,7 +735,7 @@ InputMethod -English
# InputMethod -Default # InputMethod -Default
<# <#
Move user folders location to the root of any drive using the interactive menu Change user folders location to the root of any drive using the interactive menu
User files or folders won't me moved to a new location. Move them manually User files or folders won't me moved to a new location. Move them manually
They're located in the %USERPROFILE% folder by default They're located in the %USERPROFILE% folder by default
@ -743,7 +743,7 @@ InputMethod -English
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
SetUserShellFolderLocation -Root Set-UserShellFolderLocation -Root
<# <#
Select folders for user folders location manually using a folder browser dialog Select folders for user folders location manually using a folder browser dialog
@ -754,7 +754,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Custom # Set-UserShellFolderLocation -Custom
<# <#
Change user folders location to the default values Change user folders location to the default values
@ -765,7 +765,7 @@ SetUserShellFolderLocation -Root
Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную Пользовательские файлы и папки не будут перемещены в новое расположение. Переместите их вручную
По умолчанию они располагаются в папке %USERPROFILE% По умолчанию они располагаются в папке %USERPROFILE%
#> #>
# SetUserShellFolderLocation -Default # Set-UserShellFolderLocation -Default
# Use the latest installed .NET runtime for all apps # Use the latest installed .NET runtime for all apps
# Использовать последнюю установленную среду выполнения .NET для всех приложений # Использовать последнюю установленную среду выполнения .NET для всех приложений

Loading…
Cancel
Save