none
Using DOS command in VB.net with WPF RRS feed

  • 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 ;-)
    mardi 5 avril 2011 07:29

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

     



    samedi 30 juillet 2011 19:16

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

     



    samedi 30 juillet 2011 19:16
  • 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

    dimanche 7 août 2011 07:46
    Modérateur
  • 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!!
    samedi 31 décembre 2011 14:04