Post

Tip #5: Slash in Windows Run

Many years back, I picked something up from a presentation, which left me curious. The presenter started a program with Windows Run WIN + R from a subfolder in Windows. I can’t remember, what it was. But it wasn’t in the Path variable nor registered as App Paths. The weird thing is, for this to work, you need to use a forward slash. e.g., ccm/cmtrace.

WIN + R WIN + R

While looking into a procmon trace of Windows Run, I noticed that it searches in the Windows folder for the given subfolder (ccm) and the executable (cmtrace). Not only does it search in the Windows folder, it is doing a similar thing with the HOMEPATH. Although, for some reason it does not work with subfolder + executable.

ding ding.wav

I does open subfolders (spawning explorer) in the users directory though. For example .ssh or Downloads opens explorer and navigates to the given path in HOMEPATH path.

Some examples

CommandExpected CommandResult
testdir/test.txtC:\Windows\testdir\test.txt
testdir/subdir/text.txtC:\Windows\testdir\subdir\test.txt
testdir/subdir/subdir2/text.txtC:\Windows\subdir\subdir2\test.txt
testdir/test.txtC:\Users\%username%\testdir\test.txt
testdir/subdir/test.txtC:\Users\%username%\testdir\subdir\test.txt
testdirC:\Windows\testdir\1
testdirC:\Users\%username%\testdir\
.sshC:\Users\%username%\.ssh\
DownloadsC:\Users\%username%\Downloads\2
media/tada.wavC:\Windows\media\tada.wav
media/tadaC:\Windows\media\tada.wav
ccm/cmtraceC:\Windows\ccm\cmtrace.exe
ccm/cmtrace.exeC:\Windows\ccm\cmtrace.exe
testdir/../cmtrace.exeC:\Windows\ccm\cmtrace.exe
testdir/../C:\Windows
testdir/..\C:\Windows3
\../C:\
/..\C:\
\..\C:\
..\C:\
../C:\
/../C:\
.C:\Users\%username%\
..C:\Users
:-)💥 bluescreen

Do with this information what you like, I am using it regularly to start ccmtrace.
I’ll buy the first one, to shed some light as to why the heck forward slash a 🍺 or ☕.

WIN + R, type media/tada.wav

Footnotes

  1. if the folder exists in both users home path and the windows directory, the user directory takes precedence at that will be opened. 

  2. Not if redirected 

  3. Opens root drive, c: 

This post is licensed under CC BY 4.0 by the author.