PDA

View Full Version : Why cant I make a Con?


rBg
07-10-2004, 04:32 PM
I am running Windows XP sp2, why cant I make a file on my desktop called con.*

Whether it is html or txt, it always says that file is already there, what is the deal?

:confused:

TheCotMan
07-10-2004, 05:03 PM
I am running Windows XP sp2, why cant I make a file on my desktop called con.*

Whether it is html or txt, it always says that file is already there, what is the deal?


Google (http://www.google.com/) is your friend. Try a google search for restricted characters for filenames in NTFS (http://www.google.com/search?hl=en&ie=UTF-8&q=restricted+characters+for+filenames+in+NTFS&btnG=Google+Search)
And you get this page which explains Filename Namespaces for various filesystems (http://linux-ntfs.sourceforge.net/ntfs/concepts/filename_namespace.html) as the first hit.

The "*" character is restricted by many Filesystems/OS as a wildcard and invalid for use as a filename.

Is this the question you were asking?

TheCotMan
07-10-2004, 05:23 PM
Is this the question you were asking?

If that is not what you were asking, perhaps this is what you were asking about this other windows issue...


After finding an XP machine, I tried to download a con.txt file, and Windowx XP gave me this error:

con.txt
This file is a reserved device name.
Please choose another name.


So, if you go to google (http://www.google.com/) and perform a search for con "reserved device name" (http://www.google.com/search?hl=en&lr=&ie=UTF-8&c2coff=1&q=con+%22reserved+device+name%22&btnG=Search) you get the first hit called "Naming a File [Base]" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/naming_a_file.asp) which may be an answer to your question.

Google is really fun! It should be your first stop.

[Edit: content added below here:]

Now for some background. "con" is from the old dos days for "console"

The *NIX equiv for:
$ cat > /tmp/file

Might be:
c:> type con > \tmp\file

Then you can escape with the native EOF terminator like control-d or have some success with a control-c

Both would permit you to create a file named "file" in a "tmp" dir and have the contents you enter from the CONsole appear in the file, one line at a time. Without any editor on an old dos box, this was one way you could create batch scripts.

[More added content below here:]

I also seem to recall doing things like this:
C:> type con > COM1
to send to a serial port after a MODE had been called on the port to set speed, but my mind could be hazy here.

Voltage Spike
07-11-2004, 05:28 AM
Then you can escape with the native EOF terminator like control-d

I'm not saying you are incorrect, but I thought I would clarify that the EOF terminator in DOS is Control-Z (http://www.uv.tietgen.dk/staff/mlha/PC/Soft/DOS/).

TheCotMan
07-11-2004, 05:49 AM
I'm not saying you are incorrect, but I thought I would clarify that the EOF terminator in DOS is Control-Z (http://www.uv.tietgen.dk/staff/mlha/PC/Soft/DOS/).

Naw, go for it. Say that I am incorrect. :-)
(Because that is what I was in my exact statement... incorrect.)

Thanks for the correction. Yes, for DOS you could use:
c:> type con > \tmp\file
a line of text (press return)
^Z (press return)
and then you would have a file with your lines in it, but an editor like EDIT.COM would not show a ^Z in the file.

This is the right way to do things. (Proper EOF)

The control-c method does work in many cases, but is not really the correct way to do it for DOS or many *NIX shells.

See? Nothing to be afraid of. If you correct me and you have the right answer, the readers benefit. :-)

Voltage Spike
07-11-2004, 02:02 PM
Naw, go for it. Say that I am incorrect. :-)
(Because that is what I was in my exact statement... incorrect.)

You don't have to worry about me being timid. :) I held back simply because of your phrasing: "EOF terminator like control-d". Technically, you weren't wrong: Control-D is an EOF character ... just not the right one in this case.

As with other computer people, I like to be as accurate and precise in my wording as possible. :D

Thanks for the push, though.