Advanced Windows Explorer

Advanced Windows Explorer

posted in productivity on • last updated on

A 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:

Win + E : Open Windows Explorer


From a PowerShell prompt: ii . or $aPath | ii
From a cmd prompt: start .

From within Windows Explorer itself:

Control + N : Open new window in same path

Builtin shortcuts

Control + Shift + N : Create a new directory
F2 : Rename selected. Follow with Tab to rename next.
Shift + Delete : Delete permanently
Control + C , Control + V : Duplicate file
Shift + F10 : Open context menu (or Menu) = Right click
Alt + Enter : Open directory/file properties (or Alt+Double click)
Control + Shift + 6 : Switch to details view

The 6 can be replaced with any number from 1 (Extra large icons) to 4 (Small icons), 5 (List), 7 (Tiles) and 8 (Content).

Control + L : Focus AddressBar (or Alt+D)
F4 : Open AddressBar dropdown with last typed locations

The locations are stored in: HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths

Navigation:

Alt + Up : Go to parent folder
Alt + Left : Go to previous folder (or Backspace)
Alt + Right : Go to next folder


Drag & Drop:

Control : Copy dragged file(s)
Shift : Move dragged file(s)
Control + Shift : Create shortcut

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.

Shift + F10 , w : Open command prompt in selected folder


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

Control + F1 : Toggle Ribbon
Control + Mousewheel : Scroll through the different views
Alt + P : Toggle preview pane
Control + F : Focus the search box
F11 : Full screen
F5 : Refresh
Right : Select first subfolder when there is no selection

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.


Updates
  • 30 August 2018 : Hijacking Windows + E