-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox-config.ps1
33 lines (29 loc) · 1.38 KB
/
sandbox-config.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Show-HiddenFiles {
[CmdletBinding(DefaultParameterSetName = "On")]
Param (
[Parameter(Mandatory = $true, ParameterSetName = "On")]
[System.Management.Automation.SwitchParameter]
$On,
[Parameter(Mandatory = $true, ParameterSetName = "Off")]
[System.Management.Automation.SwitchParameter]
$Off
)
Process {
# Set a variable with the value we want to set on the registry value/subkey.
if ($PSCmdlet.ParameterSetName -eq "On") { $Value = 1 }
if ($PSCmdlet.ParameterSetName -eq "Off") { $Value = 2 }
# Define the path to the registry key that contains the registry value/subkey
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
# Set the registry value/subkey.
Set-ItemProperty -Path $Path -Name Hidden -Value $Value
# Refresh open Explorer windows.
# You will need to refresh the window if you have none currently open.
# Create the Shell.Application ComObject
$Shell = New-Object -ComObject Shell.Application
# For each one of the open windows, refresh it.
$Shell.Windows() | ForEach-Object { $_.Refresh() }
}
}
Invoke-Item c:\Fractal_Source, $env:ProgramFiles
Set-Itemproperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'HideFileExt' -value 0
Show-HiddenFiles -On