Jump to content

[HELP] running a .bat file

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
jamietrent

jamietrent

    Newbie

  • Members
  • PipPip
  • 25 posts
i need a code to where when you click a buton it will open a dialog to open a .bat folder. it will run the .bat file in a textbox ..

please help me......

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
Use a CommonDialog object and look at this tutorial (there are a few pages, links to the next page are just above the Comments section). You can also look here for C#-specific information.

As far as running the .BAT, look at this tutorial. I'm not entirely sure how the Process.Start part will handle .BAT files. You can try putting just the filename of the batch program, or you might need to have "cmd.exe " followed by the name of the batch program.

For getting the output you're going to need to use Process.StandardOutputProperty and update the textbox periodically.
sudo rm -rf /

#3
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
(Accidental double-post)
sudo rm -rf /

#4
jamietrent

jamietrent

    Newbie

  • Members
  • PipPip
  • 25 posts
no i just need a code to where it will show the lines of a .cmd running in a textbox.

#5
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
The output or the source code?
sudo rm -rf /