System cannot find file even when it exists

command-line-interfacefileswindows-server-2008

I have a file that my OS (Windows 2008 Server) / File System (NTFS) are having trouble with. Here is a 'dir' of the directory:

07/20/2009  11:28 AM    <DIR>          .
07/20/2009  11:28 AM    <DIR>          ..
07/20/2009  11:28 AM             9,425 when_it_initializes.cs
               1 File(s)          9,425 bytes
               2 Dir(s)  15,536,758,784 bytes free

I am running a command prompt 'as administrator' and using the 'more' command produces:

more when_it_initializes.cs
Invalid parameter - when_it_initializes.cs

Similarly when I run 'notepad' on the file I get

The system cannot find the path specified.

The file was created by Team City, a continuous integration server that builds my code. What is weird is that it also creates over 10k other files that I have no problems opening, even when they are in sibling folders.

A check of the owner and readonly porperties look ok to me, as compared to other files that work. What is weird is that if I use 'explorer' to launch 'notepad' and open the, it works fine. I'm thinking there might be something with the command prompt that is affecting it, but I don't know.

What else can I check to see why it cannot open?

Best Answer

You can create a file like that for testing by typing the following, then hold the ALT and type 255 on the numeric keypad, then release ALT and press ENTER. This will create a filename with a hidden character at the end.

echo.>when_it_initializes.cs

However, the error message I get is:

more when_it_initializes.cs
Cannot access file c:\path\to\file\when_it_initializes.cs

I can delete it with:

del when*