Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

runtime exec of command.com mkdir malfunction

 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I get a command.com window and execute

it works perfectly. (I'm on an XP Home System)
But when I run a Java app to do the same thing via
runtime.exec() as in:


then the make directory command is limited to creating directories that have a maximum of 8 characters in their name.

Why is this? And how can I get the runtime.exec() process to execute a command.com mkdir internal command intrepeter command that creates directories with 9 or more characters?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you can't use CMD.EXE because...? Or, for that matter, java.io.File.mkdir() ?
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest,

I tried cmd.exe and everything worked perfectly. Thanks very much for your input.
I'm going to be using cmd.exe for a long list of function invocations in the windows environment some of which don't nave a java equivalent (such as net stop and start for windows services), so I wanted to be consistent in my Java app.

However, I would appreciate further information as to what needs to be considered when choosing between command.com and cmd.exe. My information (which is obviously sketchy and flawed) was that cmd.exe should be used for NT and command.com for everything else (Windows 95, 98, XP, ME, etc.).
This is obviously incorrect and I would very much like to be set straight on this matter.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer your last question: you're correct except that you put XP in the wrong pile. If Windows 2000 was NT 5, then XP is "NT 6". 95/98/ME basically follow the old "shell on top of DOS" model, whereas the NT OSs are a complete OS in themselves.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
command /?

and

cmd /?

are pretty good. The big thing to notice is one is a "MS-DOS command interpreter" and the other is a "Windows NT command interpreter".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic