Can I use a slash in the Windows open file dialog?

In the standard Windows open file dialog (the dialog that comes up with the "File > Open" menu entry in Notepad, for example), I would like to be able to type a path containing slashes /. But only backslashes are accepted (I tried in both Windows XP and Windows 7). I can open c:\autoexec.bat, but if I try opening /autoexec.bat or c:/autoexec.bat, I get the error message

c:/autoexec.bat
The file name is not valid.

Windows accepts slashes as a path separator in some contexts, but sadly not in the open file dialog, at least by default.

Is there a magic registry setting, add-on program or other reasonable¹ method that would let me use slashes in the Windows file opening dialog? I am especially interested in Office 2007 running under Windows 7, but would prefer a solution that applies to all applications that use the standard dialog under XP and 7.

“Don't use Windows” is not an option.


Solution 1:

I'm afraid the answer is no: the dialog you see is from the standard windows API, and most programs will use it. When programming it, there are a couple of options that can be turned on/off and the one casuing your problem is OFN_FILEMUSTEXIST in the OPENFILENAME structure. I could not find anything documenting how exactly it does the check, let alone a way to modify how it does it.

The only solution I see on the Windows side is patching the dll containing the function, and making it do another check allowing forward slashes, but that requires a sheer amount of skill.

On the other side things can be fixed though, if you are a programmer of some kind: the quickest I can think of (apart from modifying the source of the strings) is creating a small command line program that takes current clipboard input, converts forward to backslashes, and puts result on the clipboard again. Put it in a batch file, assign a shortcut to it and done. Your workflow would be: copy path, hit shortcut, hit Ctrl-V in dialog box, that's only one simple extra step. I think most scripting languages can get the clipboard content on windows, and they all can regex replace so it's only a few lines of code actually.