Skip to content

Instantly share code, notes, and snippets.

@krowe
Last active December 10, 2021 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krowe/febf7162838849ead3d6be26b9ebe278 to your computer and use it in GitHub Desktop.
Save krowe/febf7162838849ead3d6be26b9ebe278 to your computer and use it in GitHub Desktop.
These add a menu to Windows Explorer which shows or hides hidden files. It also will add menu items which show and hides protected system files. You can optionally also add menus for showing and hiding files which begin with a dot in the current folder.
Windows Registry Editor Version 5.00
; Created by: Kevin Rowe
; Created on: December 9, 2021
; Based on work by (you will probably want to install his script to work along with this script):
; Created by: Shawn Brink
; Tutorial: https://www.tenforums.com/tutorials/75901-hidden-items-add-context-menu-windows-10-a.html
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles]
"Icon"="imageres.dll,-5314"
"MUIVerb"="Hidden items"
"Position"="Bottom"
"Extended"=-
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x3menu]
"MUIVerb"="Hide Dot Items"
"Icon"="imageres.dll,-5314"
"CommandFlags"=dword:00000020
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x3menu\command]
@="cmd /c, wscript.exe c:\\sys\\vbs\\hidden_dot_files.vbs hide \"%V\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x4menu]
"MUIVerb"="Show Dot Items"
"Icon"="imageres.dll,-5314"
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x4menu\command]
@="cmd /c, wscript.exe c:\\sys\\vbs\\hidden_dot_files.vbs show \"%V\""
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles]
"Icon"="imageres.dll,-5314"
"MUIVerb"="Hidden items"
"Position"="Bottom"
"Extended"=-
"SubCommands"=""
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x3menu]
"MUIVerb"="Hide Dot Items"
"Icon"="imageres.dll,-5314"
"CommandFlags"=dword:00000020
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x3menu\command]
@="cmd /c, wscript.exe c:\\sys\\vbs\\hidden_dot_files.vbs hide \"%V\""
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x4menu]
"MUIVerb"="Show Dot Items"
"Icon"="imageres.dll,-5314"
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x4menu\command]
@="cmd /c, wscript.exe c:\\sys\\vbs\\hidden_dot_files.vbs show \"%V\""
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: January 27, 2017
; Updated on: March 17, 2020
; Tutorial: https://www.tenforums.com/tutorials/75901-hidden-items-add-context-menu-windows-10-a.html
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles]
"Icon"="imageres.dll,-5314"
"MUIVerb"="Hidden items"
"Position"="Bottom"
"Extended"=-
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\Windows.ShowHiddenFiles]
"CommandStateSync"=""
"Description"="@shell32.dll,-37573"
"ExplorerCommandHandler"="{f7300245-1f4b-41ba-8948-6fd392064494}"
"Icon"="imageres.dll,-5314"
"MUIVerb"="Hide/Show Hidden items"
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x1menu]
"MUIVerb"="Hide protected OS files"
"Icon"="imageres.dll,-5314"
"CommandFlags"=dword:00000020
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x1menu\command]
@="cmd /c, REG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /V ShowSuperHidden /T REG_DWORD /D 0 /F & taskkill /f /im explorer.exe & start explorer.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x2menu]
"MUIVerb"="Show protected OS files"
"Icon"="imageres.dll,-5314"
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles\shell\x2menu\command]
@="cmd /c, REG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /V Hidden /T REG_DWORD /D 1 /F & REG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /V ShowSuperHidden /T REG_DWORD /D 1 /F & taskkill /f /im explorer.exe & start explorer.exe"
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles]
"Icon"="imageres.dll,-5314"
"MUIVerb"="Hidden items"
"Position"="Bottom"
"Extended"=-
"SubCommands"=""
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\Windows.ShowHiddenFiles]
"CommandStateSync"=""
"Description"="@shell32.dll,-37573"
"ExplorerCommandHandler"="{f7300245-1f4b-41ba-8948-6fd392064494}"
"Icon"="imageres.dll,-5314"
"MUIVerb"="Hide/Show Hidden items"
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x1menu]
"MUIVerb"="Hide protected OS files"
"Icon"="imageres.dll,-5314"
"CommandFlags"=dword:00000020
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x1menu\command]
@="cmd /c, REG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /V ShowSuperHidden /T REG_DWORD /D 0 /F & taskkill /f /im explorer.exe & start explorer.exe"
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x2menu]
"MUIVerb"="Show protected OS files"
"Icon"="imageres.dll,-5314"
[HKEY_CLASSES_ROOT\Folder\shell\HiddenFiles\shell\x2menu\command]
@="cmd /c, REG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /V Hidden /T REG_DWORD /D 1 /F & REG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\" /V ShowSuperHidden /T REG_DWORD /D 1 /F & taskkill /f /im explorer.exe & start explorer.exe"
; Created by: Kevin Rowe
; Created on: December 9, 2021
' This script modifies the attribute of all files in a directory which start with a dot.
' This is useful because Linux filesystems understand this to mean that the file\directory
' should always be hidden and sometime we want to use applications which use this system
' on Windows machines without cluttering up our directories. This script does not recurse
' the directory to find all dot files and it doesn't recursively hide items in dot directories.
' In other words, it only modifies file attributes in the given directory. You may optionally
' provide a boolean value as the first parameter to indicate whether to show or hide the dot
' files. If it isn't given they will be hidden.
' Example useage:
' wscript.exe .\hidden_dot_files.vbs "c:\\"
' wscript.exe .\hidden_dot_files.vbs show "c:\\"
If WScript.Arguments.Count > 0 Then
If WScript.Arguments.Count > 1 Then
strShow = WScript.Arguments(0)
strPath = WScript.Arguments(1)
bShow=( strShow = "0" Or StrComp(strShow, "false", 1) = 0 Or StrComp(strShow, "no", 1) = 0 Or StrComp(strShow, "show", 1) = 0 )
If bShow = False Then
bHide=( strShow = "1" Or StrComp(strShow, "true", 1) = 0 Or StrComp(strShow, "yes", 1) = 0 Or StrComp(strShow, "hide", 1) = 0 )
If bHide = False Then ' We have > 1 argument and the first argument is not a valid boolean value.
Wscript.Echo "When more than one argument is given the first argument must be a boolean value (0, 1, true, false, yes, no, show, and hide are all accepted) indicating whether the dot files should be hidden."
wscript.Quit(1)
End If
End If
Else
strPath = WScript.Arguments(0)
bShow = False
End If
strLastChar = Mid(strPath, Len(strPath), 1)
If strLastChar = "\" Or strLastChar = "/" Then
strPath = Mid(strPath, 1, Len(strPath)-1)
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
strPath=objFSO.GetAbsolutePathName(strPath)
If objFSO.FolderExists(strPath) Then
Set objShell = CreateObject("Wscript.Shell")
If bShow Then
objShell.run "cmd.exe /C ATTRIB -H /s /d """ & strPath & "\.*""", 0, False
Else
objShell.run "cmd.exe /C ATTRIB +H /s /d """ & strPath & "\.*""", 0, False
End If
' sMsg="The folder path,""" & strPath & "\.*"" will "
' If bShow = False Then sMsg = sMsg & "not "
' sMsg = sMsg & "be shown."
' Wscript.Echo sMsg
wscript.Quit(0)
Else
Wscript.Echo "The folder path does not exist. Path given: " & strPath
wscript.Quit(2)
End If
Else
WScript.Echo "You must supply the folder path to be modified."
wscript.Quit(3)
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment