<h2>The NUL technique seems to only work on 8.3 compliant file names.</h2>
<h3>(In other words, `D:\Documents and Settings` is "bad" and `D:\DOCUME~1` is "good")</h3>
---------------
I think there is some difficulty using the "NUL" tecnique when there are SPACES in the directory name, such as "Documents and Settings."
I am using Windows XP service pack 2 and launching the cmd prompt from %SystemRoot%\system32\cmd.exe
Here are some examples of what DID NOT work and what DOES WORK for me:
(These are all demonstrations done "live" at an interactive prompt. I figure that you should get things to work there before trying to debug them in a script.)
**This DID NOT work:**
`D:\Documents and Settings>if exist "D:\Documents and Settings\NUL" echo yes`
**This DID NOT work:**
`D:\Documents and Settings>if exist D:\Documents and Settings\NUL echo yes`
**This DOES work (for me):**
`D:\Documents and Settings>cd ..`
`D:\>REM get the short 8.3 name for the file`
`D:\>dir /x`
` Volume in drive D has no label.`
` Volume Serial Number is 34BE-F9C9`
` Directory of D:\`
<BR>
`09/25/2008 05:09 PM <DIR> 2008`<BR>
`09/25/2008 05:14 PM <DIR> 200809~1.25 2008.09.25`<BR>
`09/23/2008 03:44 PM <DIR> BOOST_~3 boost_repo_working_copy`<BR>
`09/02/2008 02:13 PM 486,128 CHROME~1.EXE ChromeSetup.exe`<BR>
`02/14/2008 12:32 PM <DIR> cygwin`<BR>
[[Look right here !!!! ]]<br>
`09/25/2008 08:34 AM <DIR> DOCUME~1 Documents and Settings`<BR>
`09/11/2008 01:57 PM 0 EMPTY_~1.TXT empty_testcopy_file.txt`<BR>
`01/21/2008 06:58 PM <DIR> NATION~1 National Instruments Downloads`<BR>
`10/12/2007 11:25 AM <DIR> NVIDIA`<BR>
`05/13/2008 09:42 AM <DIR> Office10`<BR>
`09/19/2008 11:08 AM <DIR> PROGRA~1 Program Files`<BR>
`12/02/1999 02:54 PM 24,576 setx.exe`<BR>
`09/15/2008 11:19 AM <DIR> TEMP`<BR>
`02/14/2008 12:26 PM <DIR> tmp`<BR>
`01/21/2008 07:05 PM <DIR> VXIPNP`<BR>
`09/23/2008 12:15 PM <DIR> WINDOWS`<BR>
`02/21/2008 03:49 PM <DIR> wx28`<BR>
`02/29/2008 01:47 PM <DIR> WXWIDG~2 wxWidgets`<BR>
` 3 File(s) 510,704 bytes`<BR>
` 20 Dir(s) 238,250,901,504 bytes free`<BR>
`D:\>REM now use the \NUL test with the 8.3 name`
`D:\>if exist d:\docume~1\NUL echo yes`
`yes`
**This works, but it's sort of silly, because the dot already implies i am in a directory:**
`D:\Documents and Settings>if exist .\NUL echo yes`