Added option to change the location that File Explorer opens to (#133)

This commit is contained in:
Raphire
2024-10-27 19:28:43 +01:00
parent b7556ad0cd
commit 04e313aef4
12 changed files with 91 additions and 0 deletions

View File

@@ -33,6 +33,10 @@ param (
[switch]$RevertContextMenu,
[switch]$HideHome,
[switch]$HideGallery,
[switch]$ExplorerToHome,
[switch]$ExplorerToThisPC,
[switch]$ExplorerToDownloads,
[switch]$ExplorerToOneDrive,
[switch]$DisableOnedrive, [switch]$HideOnedrive,
[switch]$Disable3dObjects, [switch]$Hide3dObjects,
[switch]$DisableMusic, [switch]$HideMusic,

View File

@@ -23,6 +23,7 @@ Bing, Copilot & More
- Disable Windows Recall snapshots. (Windows 11 only)
File Explorer
- Change the default location that File Explorer opens to.
- Show hidden files, folders & drives.
- Show file extensions for known file types.
- Hide the gallery section from the File Explorer sidepanel. (Windows 11 only)

View File

@@ -33,6 +33,7 @@ The script also includes many features that system administrators will enjoy. Su
#### File Explorer
- Change the default location that File Explorer opens to.
- Show hidden files, folders and drives.
- Show file extensions for known file types.
- Hide the Home or Gallery section from the File Explorer navigation pane. (Windows 11 only)
@@ -328,6 +329,10 @@ The quick and advanced usage methods support switch parameters. A table of all t
| -DisableRecall | Disable Windows Recall snapshots. (Windows 11 only) |
| -HideHome | Hide the home section from the File Explorer navigation pane and add a toggle in the File Explorer folder options. (Windows 11 only) |
| -HideGallery | Hide the gallery section from the File Explorer navigation pane and add a toggle in the File Explorer folder options. (Windows 11 only) |
| -ExplorerToHome | Changes the page that File Explorer opens to to `Home` |
| -ExplorerToThisPC | Changes the page that File Explorer opens to to `This PC` |
| -ExplorerToDownloads | Changes the page that File Explorer opens to to `Downloads` |
| -ExplorerToOneDrive | Changes the page that File Explorer opens to to `OneDrive` |
| -HideOnedrive | Hide the OneDrive folder from the File Explorer navigation pane. (Windows 10 only) |
| -Hide3dObjects | Hide the 3D objects folder under 'This pc' in File Explorer. (Windows 10 only) |
| -HideMusic | Hide the music folder under 'This pc' in File Explorer. (Windows 10 only) |

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000003

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000002

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000004

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000001

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[hkey_users\default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000003

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[hkey_users\default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000002

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[hkey_users\default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000004

View File

@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00
[hkey_users\default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"LaunchTo"=dword:00000001

View File

@@ -35,6 +35,10 @@ param (
[switch]$RevertContextMenu,
[switch]$HideHome,
[switch]$HideGallery,
[switch]$ExplorerToHome,
[switch]$ExplorerToThisPC,
[switch]$ExplorerToDownloads,
[switch]$ExplorerToOneDrive,
[switch]$DisableOnedrive, [switch]$HideOnedrive,
[switch]$Disable3dObjects, [switch]$Hide3dObjects,
[switch]$DisableMusic, [switch]$HideMusic,
@@ -1048,6 +1052,35 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or ($SPP
Write-Output ""
if ($( Read-Host -Prompt "Do you want to make any changes to File Explorer? (y/n)" ) -eq 'y') {
# Show options for changing the File Explorer default location
Do {
Write-Output ""
Write-Host " Options:" -ForegroundColor Yellow
Write-Host " (n) No change" -ForegroundColor Yellow
Write-Host " (1) Open File Explorer to 'Home'" -ForegroundColor Yellow
Write-Host " (2) Open File Explorer to 'This PC'" -ForegroundColor Yellow
Write-Host " (3) Open File Explorer to 'Downloads'" -ForegroundColor Yellow
Write-Host " (4) Open File Explorer to 'OneDrive'" -ForegroundColor Yellow
$ExplSearchInput = Read-Host " Change the default location that File Explorer opens to? (n/1/2/3/4)"
}
while ($ExplSearchInput -ne 'n' -and $ExplSearchInput -ne '0' -and $ExplSearchInput -ne '1' -and $ExplSearchInput -ne '2' -and $ExplSearchInput -ne '3' -and $ExplSearchInput -ne '4')
# Select correct taskbar search option based on user input
switch ($ExplSearchInput) {
'1' {
AddParameter 'ExplorerToHome' "Change the default location that File Explorer opens to 'Home'"
}
'2' {
AddParameter 'ExplorerToThisPC' "Change the default location that File Explorer opens to 'This PC'"
}
'3' {
AddParameter 'ExplorerToDownloads' "Change the default location that File Explorer opens to 'Downloads'"
}
'4' {
AddParameter 'ExplorerToOneDrive' "Change the default location that File Explorer opens to 'OneDrive'"
}
}
Write-Output ""
if ($( Read-Host -Prompt " Show hidden files, folders and drives? (y/n)" ) -eq 'y') {
@@ -1375,6 +1408,22 @@ else {
RegImport "> Hiding the gallery section from the File Explorer navigation pane..." "Hide_Gallery_from_Explorer.reg"
continue
}
'ExplorerToHome' {
RegImport "> Changing the default location that File Explorer opens to `Home`..." "Launch_File_Explorer_To_Home.reg"
continue
}
'ExplorerToThisPC' {
RegImport "> Changing the default location that File Explorer opens to `This PC`..." "Launch_File_Explorer_To_This_PC.reg"
continue
}
'ExplorerToDownloads' {
RegImport "> Changing the default location that File Explorer opens to `Downloads`..." "Launch_File_Explorer_To_Downloads.reg"
continue
}
'ExplorerToOneDrive' {
RegImport "> Changing the default location that File Explorer opens to `OneDrive`..." "Launch_File_Explorer_To_OneDrive.reg"
continue
}
'HideDupliDrive' {
RegImport "> Hiding duplicate removable drive entries from the File Explorer navigation pane..." "Hide_duplicate_removable_drives_from_navigation_pane_of_File_Explorer.reg"
continue