Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

share|improve this question
may I ask why you want the forward slashes? you're not typing in full paths, are you? and if you are, know that with backslashes also comes the dropdown box.. no way you can type faster than making use of the dropdown completion – stijn Jun 25 '12 at 10:38
the only thing I can think of is that the OP is copy/pasting paths from a source using forward slashes; in that case, I would fix that source to output paths the windows style – stijn Jun 25 '12 at 10:43
Actually, it is a valid path separator. It was added long ago so that Windows could claim a degree of POSIX compliance. It's just that not all Windows applications support it. You can use it at the command prompt for example. See my answer for a link to a fuller explanation. You would want to use it to have scripts and applications that are more closely aligned across OS's. – Julian Knight Jun 25 '12 at 10:43
@stijn Yes, copy-paste was my use case. Since the applications I tend to copy-paste from use backslash for other things, whereas Windows treats the slash as an invalid character in this context, the Windows side is the only one that could be adapted. – Gilles Jun 25 '12 at 11:23
@JulianKnight - just a FYI, MS doesnt have a degree of POSIX compliance, it is 100% POSIX compliant with the apporpriate MS addons. See – Keltari Feb 13 '13 at 3:41
up vote 4 down vote accepted

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .