5 Replies - 1111 Views - Last Post: 09 November 2009 - 06:45 PM Rate Topic: -----

#1 nawima93  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 61
  • Joined: 07-November 09

Running Command lines.

Posted 09 November 2009 - 09:04 AM

I have been trying to figure out how to run command lines through my VB form, such as:
Shutdown
Start
Echo
Just random things, and I can't figure it out. Can someone explain to me how it works? Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: Running Command lines.

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Running Command lines.

Posted 09 November 2009 - 11:39 AM

Check out the System.Diagnostics.Process Class in the .Net Framework for this, and the ProcessStartInfo Class for providing arguments
Was This Post Helpful? 0
  • +
  • -

#3 nawima93  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 61
  • Joined: 07-November 09

Re: Running Command lines.

Posted 09 November 2009 - 01:46 PM

Im sorry, i just started yesterday. Can you give me an example please? i didn't understand any of that...
For example:
I know that the command "Shutdown -s" will shutdown the computer. How to i make it so a button on my VB form runs that console command?

This post has been edited by nawima93: 09 November 2009 - 02:23 PM

Was This Post Helpful? 0
  • +
  • -

#4 shockin!  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 136
  • Joined: 19-October 09

Re: Running Command lines.

Posted 09 November 2009 - 03:46 PM

There's prob a better way, but try this:
 System.Diagonistics.Process.Start("cmd.exe", "shutdown /s")

Was This Post Helpful? 0
  • +
  • -

#5 nawima93  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 61
  • Joined: 07-November 09

Re: Running Command lines.

Posted 09 November 2009 - 04:29 PM

Thank you very much Six... i mean Shockin.
We have a problem though.
It opens up the command prompt, but doesnt run the command... Any idea why this is?

This post has been edited by nawima93: 09 November 2009 - 04:30 PM

Was This Post Helpful? 0
  • +
  • -

#6 nmgod  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 48
  • View blog
  • Posts: 233
  • Joined: 26-March 08

Re: Running Command lines.

Posted 09 November 2009 - 06:45 PM

Shell("Shutdown.exe")
Shell("c:\program.exe myvariabletopass")
or
System.Diagonistics.Process.Start("shutdown.exe")
System.Diagonistics.Process.Start("c:\program.exe myvariabletopass")
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1