• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple CMDHelp GUI (works for some commands but not for others)

 
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I created a simple GUI where you enter a cmd command and It outputs the /? switch help.
This Is Just for practice and It's not that Important but I'm not sure why It works for certain commands
like "ping" and "shutdown" but for others like "dir" and "set" It throws an exception (CreateProcess error =2,The
system cannot find the file specified).Am I missing something simple ?

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the ones that work for you are executable programs and the ones which don't work are commands which are built into the Windows shell.

That's covered in the standard article which has been linked to for the last 14 years and still tells you what you need to know: When Runtime.exec() won't; but you should really read the whole article carefully.
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I did read that article today.Campbell Ritchie I think mentioned It In a previous post of mine.I missed that part , I did kind of skim through It.
Is there any way I can distinguish between the shell commands and executables so that I can use a different method for each type In the program ?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Runtime.exec is too difficult for “beginning” so I shall move this discussion.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic