mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
Hidden File Tweaks (#2320)
* Main * Fixes previous issues * Change the ordering of Some Toggle for Consistency --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
This commit is contained in:
parent
5b7f0a0edf
commit
af36d76e65
@ -3067,12 +3067,20 @@
|
||||
"Order": "a108_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFToggleHiddenFiles": {
|
||||
"Content": "Show Hidden Files",
|
||||
"Description": "If Enabled then Hidden Files will be shown.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Order": "a200_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFToggleShowExt": {
|
||||
"Content": "Show File Extensions",
|
||||
"Description": "If enabled then File extensions (e.g., .txt, .jpg) are visible.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Order": "a200_",
|
||||
"Order": "a201_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFToggleTaskbarSearch": {
|
||||
@ -3080,7 +3088,7 @@
|
||||
"Description": "If Enabled Search Button will be on the taskbar.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Order": "a201_",
|
||||
"Order": "a202_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFToggleTaskView": {
|
||||
@ -3088,7 +3096,7 @@
|
||||
"Description": "If Enabled then Task View Button in Taskbar will be shown.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Order": "a202_",
|
||||
"Order": "a203_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFToggleTaskbarWidgets": {
|
||||
@ -3096,7 +3104,7 @@
|
||||
"Description": "If Enabled then Widgets Button in Taskbar will be shown.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Order": "a203_",
|
||||
"Order": "a204_",
|
||||
"Type": "Toggle"
|
||||
},
|
||||
"WPFOOSUbutton": {
|
||||
|
@ -125,6 +125,17 @@ Function Get-WinUtilToggleStatus {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
|
||||
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
||||
if($HiddenFiles -eq 0){
|
||||
return $false
|
||||
}
|
||||
else{
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||
if($TaskbarWidgets -eq 0) {
|
||||
|
34
functions/private/Invoke-WinUtilHiddenFiles.ps1
Normal file
34
functions/private/Invoke-WinUtilHiddenFiles.ps1
Normal file
@ -0,0 +1,34 @@
|
||||
function Invoke-WinUtilHiddenFiles {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enable/Disable Hidden Files
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Hidden Files
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
Try{
|
||||
if ($Enabled -eq $false){
|
||||
Write-Host "Enabling Hidden Files"
|
||||
$value = 1
|
||||
}
|
||||
else {
|
||||
Write-Host "Disabling Hidden Files"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
Set-ItemProperty -Path $Path -Name Hidden -Value $value
|
||||
}
|
||||
Catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
}
|
||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -30,5 +30,6 @@ function Invoke-WPFToggle {
|
||||
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
||||
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
|
||||
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
|
||||
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user