Hi All,
I have created a CON, PRN folder(http://www.hoax-slayer.com/con-folder-name.shtml) using "md\\.\\c:\con " through DOS prompt, i was trying to create same CON and PRN folder through Java code using
"Runtime.getRuntime().exec("md\\\\.\\d:\\con");"

But it is giving following Exception :

Cannot run program "md\\.\d:\con": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source)"

Please guide me how to make the CON folder through JAVA code.

Thanks in advance.

Any good reason to mess around with Runtime when you do the same with mkdir() method of File class?

And for general information read this article thoroughly. You are falling into the "not a command" trap.

But Peter is correct, you should not be using Runtime for this, at all.

Any good reason to mess around with Runtime when you do the same with mkdir() method of File class?

I want to create a CON name folder, which is normally not possible with mkdir(); (As this is OS reserved Word) that's why i tried it out with "Runtime.getRuntime().exec("mkdir c:\con\\");" because DOS prompt allows us to create CON folder with "mkdir c:\con\".

Just give us one good reason why it MUST BE called con and not something else?

Just give us one good reason why it MUST BE called con and not something else?

Hi.. i want to create a folder which can not be rename and delete.. by any user(even admin).CON,PRN,NUL,AUX.. etc are some of Folder's name which OS has reserved(which restrict rename and deletion).. so just to put restriction over my folder i want to use con name for my folder

:sigh:

And have you read that article, yet?

P.S. that reasoning, as well as that command, will work just oh so well on unix platforms, as well, huh?

:sigh:

And have you read that article, yet?

P.S. that reasoning, as well as that command, will work just oh so well on unix platforms, as well, huh?

Hi,
Thanks for reply.
Yes i had gone through the article link, which you had provided.
I had tried the way explained in the article, but still facing the same problem
Firstly i want to make it work with windows.. as these CON,PRN are WINDOWS reserved word, it is not working in windows..

In what way is that? Post that code explain, exactly, what "didn't work" means.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.