Meilleur auteur de réponses
Using DOS command in VB.net with WPF

Question
-
Hi,
Would you know how I do pass a command line with WPF (in VB.net)?
In WindowsForm I used
Shell("cmd.exe /c mame -listxml >xmlout.xml", 0, True)
(the app. Name and parameters, show/hide window, wait or not for the task being completed)
Unfortunately this line doens't work anymore in WPF
What should I use to send a command line with parameters?
Thanks very much for any kind help ;-)
Réponses
-
Hi,
Rather than "doesn't work" please always describe what you see. Actually this is just because of a conflict with System.Windows.Shell (as shown by the compilation error message you likely had). You can still use the full name Microsoft.VisualBasic.Interaction.Shell to avoid this conflict.
Another option is to use Process.Start (http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx)
Je me mélange aussi parfois un peu les pinceaux - la preuve - mais ce forum ci est en français et je vois dans l'historique que vous êtes très probablement français ou en tout cas parfaitement francophone ! Donc n'oubliez pas de poster en français dans ce forum ;-)
Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
- Modifié Patrice ScribeMVP samedi 30 juillet 2011 19:22 Forum français !
- Proposé comme réponse Pascal SailleModerator mercredi 10 août 2011 08:48
- Marqué comme réponse JonathanANTOINEMVP, Moderator mercredi 10 août 2011 21:09
Toutes les réponses
-
Hi,
Rather than "doesn't work" please always describe what you see. Actually this is just because of a conflict with System.Windows.Shell (as shown by the compilation error message you likely had). You can still use the full name Microsoft.VisualBasic.Interaction.Shell to avoid this conflict.
Another option is to use Process.Start (http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx)
Je me mélange aussi parfois un peu les pinceaux - la preuve - mais ce forum ci est en français et je vois dans l'historique que vous êtes très probablement français ou en tout cas parfaitement francophone ! Donc n'oubliez pas de poster en français dans ce forum ;-)
Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
- Modifié Patrice ScribeMVP samedi 30 juillet 2011 19:22 Forum français !
- Proposé comme réponse Pascal SailleModerator mercredi 10 août 2011 08:48
- Marqué comme réponse JonathanANTOINEMVP, Moderator mercredi 10 août 2011 21:09
-
Bonjour,
Est-ce que vous avez testé la solution proposée ? Merci de partager avec nous les résultats,afin que d'autres personnes avec le même problème puissent profiter de cette solution.
Cordialement, Pascal.
Développeur Wpf/SilverLight/WinPhone7
-
Tout cela marche parfaitement, mais j'aimerais avoir une aide supplémentaire (j'ignore si je dois commencer un nvx. sujet?):
Comment puis-je faire pour afficher une ligne de texte sur la console cmd.exe, pendant que la commandes qui lui a été envoyé s'exécute?
J'ai donc:
myProcess.StartInfo.FileName = "cmd.exe" myProcess.StartInfo.Arguments = "/c mame -listxml >xmlout.xml"
et je voudrais que l'utilisateur puisse voir affiché (sur la console cmd.exe...pas sur mon application!!) un message du style "Patientez svp...."
Merci!!