473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Run command line code form my App...

Tim
Hi,

I want to run some command line instructions from within my C# windows forms
application. Basically when the application closes I want to logoff the
session if it was started remotely.

So how do I run text as if I was typing it into the command line?

Tim
Jan 3 '06 #1
2 8117
Tim <ti*@home.com> wrote:
I want to run some command line instructions from within my C# windows forms
application. Basically when the application closes I want to logoff the
session if it was started remotely.

So how do I run text as if I was typing it into the command line?


See http://www.pobox.com/~skeet/csharp/faq/#process.start for starting
another process. If you need to run commands which are built into the
shell, you'll need to run the shell explicitly.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 3 '06 #2
Use the Process class and execute the program you want to run. If it's a
built-in cmd-command you want to run, just start "cmd.exe /c commandname"

The /c tells cmd to terminate when done and the commandname is the internal
command (and optional parameters) you want it to perform.

Arild

"Tim" <ti*@home.com> wrote in message
news:FH********************@news20.bellglobal.com. ..
Hi,

I want to run some command line instructions from within my C# windows
forms application. Basically when the application closes I want to logoff
the session if it was started remotely.

So how do I run text as if I was typing it into the command line?

Tim

Jan 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
I used to execute a command line script in IIS 4 using Dynuexec. This is a third part server object I installed on the server (http://www.dynu.com/dynuexec.asp). I installed this object onto my...
0
by: Jon Paal | last post by:
what would be the command line code to add an image as a resource to a dll ?
3
by: edfialk | last post by:
Hi, all I'm trying to do is load the php_mapscript.so library into php. Here's the php file: Code: dl("php_mapscriot.so") if (extension_loaded("MapScript")) echo "works!"; else echo...
1
by: gdarian216 | last post by:
okay I had a code that asked user to input a file name and instead i changed it to take the input from the command line. I now want to output results of some functions to an output file. I have...
11
ironmonkey69
by: ironmonkey69 | last post by:
Right now, I have this python script that lets me choose which column of a text file that I can zero out. Them column nubmer is stored as the variable 'elem'. I also was given a sample of taking in...
0
by: Liam Se Imihaf | last post by:
Hi all, I have a problem get the "command line" of a process in C# for some processes (ie, tomcat5.exe). I am using Win2003. I can use wmci as in: wmic process where name="tomcat5.exe" get...
6
code green
by: code green | last post by:
The following code is part of a script actioned by a web form if(isset($_POST))#the form has been submitted { if($pls = $_POST) #hidden variable in pricesCostForm { $levels = array();...
1
by: Zygor1 | last post by:
Without going into details; I have the need to pass a string containing double backslashes \\ from the DOS command line and convert these to single backslashes in the code. The problem is if I do...
0
by: SCastro | last post by:
I can't remember the command line/code which has a "-1" to cause any alert/information window to not pop-up when you run a report.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.