• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2019
  • Last Modified:

How to call system commands

hello/

how do i call system commands such as 'dir', 'cd' etc

thanks / p
0
pipe
Asked:
pipe
  • 3
  • 2
  • 2
  • +1
1 Solution
 
gregoryyoungCommented:
Use Process.Start() in system.diagnostics ... in order to run such commands you issue cmd /C command ...

Process.Start("cmd.exe", "/C dir"); (or use the startinfo overload) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic2.asp
0
 
sohilmCommented:
What are you trying to accomplish? Are you trying to modify files, or display files on the screen?
0
 
gregasmCommented:
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
gregoryyoungCommented:
gregasm isnt

Process.Start("cmd.exe", "/C dir")
and
Shell("cmd.exe","/C dir")

nearly the same thing ? :)
0
 
gregoryyoungCommented:
in fact shell calls Process.Start :P
0
 
gregasmCommented:
shell("explorer.exe ""c:\my music\""")

something like that. right on.
0
 
pipeAuthor Commented:
ill look into this tonight. i am making my own command prompt and i was just gonna issue the commands (like suggested above) and return the results to my custom command prompt.
0
 
sohilmCommented:
well I suggest using the system.io.directoryinfo and system.io.fileinfo to get info and do some basic tasks. This way you have more control on what to show on the screen.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now