Advanced Windows Explorer
posted in productivity on • by Wouter Van Schandevijl • last updated onA listing of handy but less known shortcuts in Windows Explorer and some Autohotkey examples on how to add extra functionality.
Open Windows Explorer, the most direct way:
From a PowerShell prompt: ii .
or $aPath | ii
From a cmd prompt: start .
From within Windows Explorer itself:
Builtin shortcuts
The 6 can be replaced with any number from 1 (Extra large icons) to 4 (Small icons), 5 (List), 7 (Tiles) and 8 (Content).
The locations are stored in: HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths
Navigation:
Drag & Drop:
Create a new dotfile
To work around “You must type a file name”, append an additional dot at the end of the filename.
.gitignore.
Or in PowerShell: ac .gitignore "node_modules"
Back to the CLI
Alt+D followed by cmd or powershell will open a prompt at the current path.
Jump to an env var
Alt+D followed by %APPDATA%
, %USERPROFILE%
or any environment variable.
Or one of the shell commands like shell:startup
, shell:sendto
or shell:desktop
# List all "shell:" locations
# (Not nearly all paths are printed because of naming mismatches)
$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions"
Get-ChildItem $path | Select-Object `
@{l="Name";e={$_.GetValue("Name")}},`
@{l="Path";e={[Environment]::GetFolderPath($_.GetValue("Name")).Replace(" ", "")}}
Less used shortcuts
Autohotkey Extensions
Add missing stuff yourself with Autohotkey.
Find the source for the Autohotkey scripts here
Execute shortcut code only when Windows Explorer is active:
SetTitleMatchMode Regex
#IfWinActive ahk_class CabinetWClass|ExploreWClass|Progman|WorkerW
; "ahk_class CabinetWClass|ExploreWClass" executes in Windows Explorer
; "ahk_class Progman|WorkerW" executes on Desktop
#IfWinActive
Some of the scripts use the following methods. They are defined in windows-explorer-util.ahk.
; Get the currently active path
Explorer_GetPath()
; Get the currently selected file(s)
Explorer_GetSelected()
Hijacking Windows + E
If the selected text while pressing Windows E is a path, open Windows Explorer in that specific path.
~#e::
; Save clipboard
oldClip := clipboard
; Send Control+C
Send, ^c
ClipWait, 3
clipVal := clipboard
; Does the copied text contain a path?
fileExists := FileExist(clipVal)
if (fileExists = "D") {
; Open explorer in specific directory
Run % "explorer.exe /root," clipVal
} else if (fileExists) {
; Open explorer with file selected
Run % "explorer.exe /select," clipVal
} else {
; Simply open explorer
Send #e
}
; Restore the clipboard
clipboard := oldClip
Return
Zip directory
Ahk source for creating a zip file with the contents of the current directory or the currently selected files.
Create new file
One creates a new directory with Control + Shift + N but there is not really one for creating a new file.
; Control + Shift + F: New file
^+f::
DeselectSelectedFiles()
Send {Appskey}
Send w
Send t
Send ^a
Return
; Control + Shift + T: New txt file
^+t::
DeselectSelectedFiles()
Send {Appskey}
Send w
Send t
Return
DeselectSelectedFiles()
{
; Explorer_GetSelected is defined in utilities/windows-explorer-util.ahk
selectedFiles := Explorer_GetSelected()
if selectedFiles
{
; If no file is selected, ^Space may actually select it
; after which {AppsKey} will open the wrong ContextMenu
Send ^{Space}
}
}
Other
Change extension dialog:
Windows doesn’t offer an option to not show a confirmation dialog
when changing the extension of a file. The best we can do is wait
and whenever one pops up click it away?
While, 1
{
WinWaitActive, Rename ahk_class #32770
Send y
}
Details View:
While Control + Shift + 6
is probably very useful, pesky Windows
might truncate longer filenames with the switch to Details View.
; Control + Shift + 6: Details View
; ~ = Do not block native function
~^+6::
; Resize columns so that filenames are completely visible
Send {Control Down}{NumpadAdd}{Control Up}
Return
Closing:
Closing an Explorer window can be done with Alt+F4 or with Control+W.
But when you want to close it after Windows annoyed you, this scrips allows you
to you to do so by hitting Esc hard, twice.
~Esc::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
WinClose
Return
(I guess I just didn’t know about Control + W before this post:)
Alternatives:
According to AlternativeTo Windows Explorer, many people like Total Commander.
- 30 August 2018 : Hijacking Windows + E