Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to call system commands

Posted on 2004-09-08
8
Medium Priority
?
2,014 Views
Last Modified: 2010-04-15
hello/

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

thanks / p
0
Comment
Question by:pipe
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 400 total points
ID: 12007919
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
 
LVL 3

Expert Comment

by:sohilm
ID: 12007931
What are you trying to accomplish? Are you trying to modify files, or display files on the screen?
0
 
LVL 8

Expert Comment

by:gregasm
ID: 12009924
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 37

Expert Comment

by:gregoryyoung
ID: 12009958
gregasm isnt

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

nearly the same thing ? :)
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 12009961
in fact shell calls Process.Start :P
0
 
LVL 8

Expert Comment

by:gregasm
ID: 12010014
shell("explorer.exe ""c:\my music\""")

something like that. right on.
0
 

Author Comment

by:pipe
ID: 12010237
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
 
LVL 3

Expert Comment

by:sohilm
ID: 12010404
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question