diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index 7f5ef470..dbe026c1 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -7098,11 +7098,8 @@ function Set-UserShellFolderLocation .SYNOPSIS Change the location of the each user folder using SHSetKnownFolderPath function - .PARAMETER RemoveDesktopINI - The RemoveDesktopINI argument removes desktop.ini in the old user shell folder - .EXAMPLE - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" .LINK https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath @@ -7122,11 +7119,7 @@ function Set-UserShellFolderLocation [Parameter(Mandatory = $true)] [string] - $FolderPath, - - [Parameter(Mandatory = $false)] - [switch] - $RemoveDesktopINI + $FolderPath ) <# @@ -7245,10 +7238,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int } # Removing old desktop.ini - if ($RemoveDesktopINI) - { - Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore - } + Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore 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 @@ -7292,7 +7282,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" } $Skip { @@ -7320,7 +7310,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" } $Skip { @@ -7348,7 +7338,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" } $Skip { @@ -7376,7 +7366,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" } $Skip { @@ -7404,7 +7394,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" } $Skip { @@ -7432,7 +7422,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" } $Skip { @@ -7473,7 +7463,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7513,7 +7503,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7553,7 +7543,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7593,7 +7583,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7633,7 +7623,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7673,7 +7663,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7705,7 +7695,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" } $Skip { @@ -7734,7 +7724,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" } $Skip { @@ -7763,7 +7753,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" } $Skip { @@ -7792,7 +7782,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" } $Skip { @@ -7821,7 +7811,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" } $Skip { @@ -7850,7 +7840,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" } $Skip { diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 index 86e8e82c..0407b7be 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 @@ -5738,11 +5738,8 @@ function Set-UserShellFolderLocation .SYNOPSIS Change the location of the each user folder using SHSetKnownFolderPath function - .PARAMETER RemoveDesktopINI - The RemoveDesktopINI argument removes desktop.ini in the old user shell folder - .EXAMPLE - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" .LINK https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath @@ -5762,11 +5759,7 @@ function Set-UserShellFolderLocation [Parameter(Mandatory = $true)] [string] - $FolderPath, - - [Parameter(Mandatory = $false)] - [switch] - $RemoveDesktopINI + $FolderPath ) <# @@ -5885,10 +5878,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int } # Removing old desktop.ini - if ($RemoveDesktopINI) - { - Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore - } + Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore 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 @@ -5932,7 +5922,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" } $Skip { @@ -5960,7 +5950,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" } $Skip { @@ -5988,7 +5978,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" } $Skip { @@ -6016,7 +6006,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" } $Skip { @@ -6044,7 +6034,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" } $Skip { @@ -6072,7 +6062,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" } $Skip { @@ -6113,7 +6103,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6153,7 +6143,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6193,7 +6183,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6233,7 +6223,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6273,7 +6263,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6313,7 +6303,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6345,7 +6335,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" } $Skip { @@ -6374,7 +6364,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" } $Skip { @@ -6403,7 +6393,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" } $Skip { @@ -6432,7 +6422,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" } $Skip { @@ -6461,7 +6451,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" } $Skip { @@ -6490,7 +6480,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" } $Skip { diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 index 42c18ec3..4a59bcb2 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 @@ -6124,11 +6124,8 @@ function Set-UserShellFolderLocation .SYNOPSIS Change the location of the each user folder using SHSetKnownFolderPath function - .PARAMETER RemoveDesktopINI - The RemoveDesktopINI argument removes desktop.ini in the old user shell folder - .EXAMPLE - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" .LINK https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath @@ -6148,11 +6145,7 @@ function Set-UserShellFolderLocation [Parameter(Mandatory = $true)] [string] - $FolderPath, - - [Parameter(Mandatory = $false)] - [switch] - $RemoveDesktopINI + $FolderPath ) <# @@ -6271,10 +6264,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int } # Removing old desktop.ini - if ($RemoveDesktopINI) - { - Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore - } + Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore 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 @@ -6318,7 +6308,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" } $Skip { @@ -6346,7 +6336,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" } $Skip { @@ -6374,7 +6364,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" } $Skip { @@ -6402,7 +6392,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" } $Skip { @@ -6430,7 +6420,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" } $Skip { @@ -6458,7 +6448,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" } $Skip { @@ -6499,7 +6489,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6539,7 +6529,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6579,7 +6569,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6619,7 +6609,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6659,7 +6649,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6699,7 +6689,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -6731,7 +6721,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" } $Skip { @@ -6760,7 +6750,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" } $Skip { @@ -6789,7 +6779,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" } $Skip { @@ -6818,7 +6808,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" } $Skip { @@ -6847,7 +6837,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" } $Skip { @@ -6876,7 +6866,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" } $Skip { diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 index dac649b2..cb87a50a 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 @@ -7103,11 +7103,8 @@ function Set-UserShellFolderLocation .SYNOPSIS Change the location of the each user folder using SHSetKnownFolderPath function - .PARAMETER RemoveDesktopINI - The RemoveDesktopINI argument removes desktop.ini in the old user shell folder - .EXAMPLE - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" .LINK https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath @@ -7127,11 +7124,7 @@ function Set-UserShellFolderLocation [Parameter(Mandatory = $true)] [string] - $FolderPath, - - [Parameter(Mandatory = $false)] - [switch] - $RemoveDesktopINI + $FolderPath ) <# @@ -7250,10 +7243,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int } # Removing old desktop.ini - if ($RemoveDesktopINI) - { - Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore - } + Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore 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 @@ -7297,7 +7287,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" } $Skip { @@ -7325,7 +7315,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" } $Skip { @@ -7353,7 +7343,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" } $Skip { @@ -7381,7 +7371,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" } $Skip { @@ -7409,7 +7399,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" } $Skip { @@ -7437,7 +7427,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" } $Skip { @@ -7478,7 +7468,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7518,7 +7508,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7558,7 +7548,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7598,7 +7588,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7638,7 +7628,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7678,7 +7668,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7710,7 +7700,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" } $Skip { @@ -7739,7 +7729,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" } $Skip { @@ -7768,7 +7758,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" } $Skip { @@ -7797,7 +7787,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" } $Skip { @@ -7826,7 +7816,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" } $Skip { @@ -7855,7 +7845,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" } $Skip { diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index 8fa4b7f8..0cb7bebf 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -2406,6 +2406,11 @@ function BrowsingHistory $Show ) + if ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -lt 23451) + { + return + } + switch ($PSCmdlet.ParameterSetName) { "Hide" @@ -7002,11 +7007,8 @@ function Set-UserShellFolderLocation .SYNOPSIS Change the location of the each user folder using SHSetKnownFolderPath function - .PARAMETER RemoveDesktopINI - The RemoveDesktopINI argument removes desktop.ini in the old user shell folder - .EXAMPLE - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" .LINK https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath @@ -7026,11 +7028,7 @@ function Set-UserShellFolderLocation [Parameter(Mandatory = $true)] [string] - $FolderPath, - - [Parameter(Mandatory = $false)] - [switch] - $RemoveDesktopINI + $FolderPath ) <# @@ -7149,10 +7147,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int } # Removing old desktop.ini - if ($RemoveDesktopINI) - { - Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore - } + Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore 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 @@ -7196,7 +7191,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" } $Skip { @@ -7224,7 +7219,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" } $Skip { @@ -7252,7 +7247,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" } $Skip { @@ -7280,7 +7275,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" } $Skip { @@ -7308,7 +7303,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" } $Skip { @@ -7336,7 +7331,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" } $Skip { @@ -7377,7 +7372,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7417,7 +7412,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7457,7 +7452,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7497,7 +7492,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7537,7 +7532,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7577,7 +7572,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7609,7 +7604,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" } $Skip { @@ -7638,7 +7633,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" } $Skip { @@ -7667,7 +7662,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" } $Skip { @@ -7696,7 +7691,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" } $Skip { @@ -7725,7 +7720,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" } $Skip { @@ -7754,7 +7749,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" } $Skip { diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index 73544faa..11aa367d 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -2407,6 +2407,11 @@ function BrowsingHistory $Show ) + if ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -lt 23451) + { + return + } + switch ($PSCmdlet.ParameterSetName) { "Hide" @@ -7004,11 +7009,8 @@ function Set-UserShellFolderLocation .SYNOPSIS Change the location of the each user folder using SHSetKnownFolderPath function - .PARAMETER RemoveDesktopINI - The RemoveDesktopINI argument removes desktop.ini in the old user shell folder - .EXAMPLE - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" .LINK https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath @@ -7028,11 +7030,7 @@ function Set-UserShellFolderLocation [Parameter(Mandatory = $true)] [string] - $FolderPath, - - [Parameter(Mandatory = $false)] - [switch] - $RemoveDesktopINI + $FolderPath ) <# @@ -7151,10 +7149,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int } # Removing old desktop.ini - if ($RemoveDesktopINI) - { - Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore - } + Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore 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 @@ -7198,7 +7193,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" } $Skip { @@ -7226,7 +7221,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" } $Skip { @@ -7254,7 +7249,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" } $Skip { @@ -7282,7 +7277,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" } $Skip { @@ -7310,7 +7305,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" } $Skip { @@ -7338,7 +7333,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { {$DriveLetters -contains $Choice} { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" } $Skip { @@ -7379,7 +7374,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7419,7 +7414,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7459,7 +7454,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7499,7 +7494,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7539,7 +7534,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7579,7 +7574,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int if ($FolderBrowserDialog.SelectedPath) { - Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath } } $Skip @@ -7611,7 +7606,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" } $Skip { @@ -7640,7 +7635,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" } $Skip { @@ -7669,7 +7664,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" } $Skip { @@ -7698,7 +7693,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" } $Skip { @@ -7727,7 +7722,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" } $Skip { @@ -7756,7 +7751,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int { $Yes { - Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI + Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" } $Skip {