Information générale
Catégorie:
Codage, syntaxe et commandes
>string command="cls";
>Process proc = runtime.getRuntime().exec(command);
>
>Any idea why this won't work?
What do mean by won't work? Does it display an error message? The program crashes? It doesn't do anything?
Because quite frankly, it should work. I've never tried this but your code seems well written (grammatically correct.) The only thing I would try, probably if you get a message like "The name specified is not recognized as a...", is to put the entire path for the "cls" program in the command because Java's exec function might not respect the PATH environment variable.
Other than that, tell me what happens when you try it and I'll see if I can be of any help.
Good luck, Stephane.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement