1.11M Members

Create CON folder through JAVA

 
0
 

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.

 
0
 

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

 
0
 

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.

 
0
 

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\".

 
0
 

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

 
0
 

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

 
0
 

: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?

 
0
 

: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..

 
0
 

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

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article