get Command line scripting results!

Hey all,

i have a web application that at a given point i make this application execute a batch file, this batch file contains commands executed in command line to do specific actions.
as i do execute that batch file programmatically, i'm looking for a way to read the result of executing these commands......

e.g. if you write "C:\>hhhshs" the result would be "hhhshs is not recognized as an internal or external command, operable program or batch file"

if you write "C:\>ipconfig" the result woul be sth else.

what i want is a way how to read these results programmatically!! anyone can help??

 thanks,

OMomani

0
omomani
5/10/2008 1:52:06 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

3 Replies
632 Views

Similar Articles

[PageSpeed] 48
Get it on Google Play
Get it on Apple App Store

I think you should be able to just check return value of Process.Start? I think it will return false if the process cannot be started.

The error message you're referring to will only appear in a command shell. So to get this from Process.Start, you'd have to wrap your process in a call to cmd.exe. But that's totally unecessary :)


If this post was useful to you, please mark it as answer. Thank you!
0
johram
5/10/2008 11:46:42 PM

thank you Johram for your reply :)

actually some commands starts but it will be failed, so that i will get true, but its not enough because the process has not been completed!

am i talking right?

0
omomani
5/11/2008 6:34:10 AM

So the process starts alright but fail somewhere along the way, right? If the program (that you're trying to launch) is written correctly, you should be able to get the exit code of the application. Typically 0 means a successful run, while any other code can be used to signal different errors that has occurred. But that's no law, so you need to check how that specific program behaves first. A second option you have (if exit code does not work) is to capture the output of the program, and try to parse stuff from there. But this is to be used only as a last resort.

Best thing is if you can check (and possibly re-program) the exe you're trying to start so that it makes use of exit codes. In a console app, that's the value returned from the main function. In a windows app, I don't know, but I guess it's the same.


If this post was useful to you, please mark it as answer. Thank you!
0
johram
5/11/2008 2:21:24 PM
Reply:

Similar Artilces:

POST GET GET GET GET... WTH?
Hi, I'm at a loss to explain this... I have an ASPX page that I can't always navigate to. When I developed the app (it's Starter Kit Portal-based), I did it on my LAN and have had no trouble accessing the page. However, upon deployment, I see the following behavior: 1. POST request goes out looking for MyForm.aspx 2. GET request for MyForm.aspx 3. GET request for MyForm.aspx 4. ... X. GET request Sometimes, the page finally loads. Other times, it just ends up blank. Many times, it doesn't load at ALL the first POST - I just get a "The pa...

TFS Command Line Get Command
Hi Can you pls help me how to pull the latest version or label from the TFS through Command Line. I went through the msdn documentation. I am not able to get a clear picture. I am expecting some command with example where I can pass the server name, Credentials and sourcepath and Destination path. Basically I want to pull the get latest to a local path which  will be specified in the command line utility. Hope so I am clear.  Pls help me.RegardsFinny  You can use tf command line utilityThis utility can be found in C:/ProgramFiles/Microsoft Visual Studio (9 or 8...

Command line script to get latest from VSS for PB 8
Hi! I am using Powerbuilder 8 and Microsoft Visual Source Safe for the source control. I am trying to create a batch file which will get the latest source from the VSS and will start the build. My problem is how to get the latest source from the VSS, using batch file. I have the script for creating the build from command line but now I am stuck with the latest source problem. I was searching for the help on the net and I found that PB 9 comes with a utility ORCASCR9.exe by using which I can easily perform the desired tasks but that utility does not run with PB 8... so noway to go ...

how to get the line number of a line in a Power script ?
in the C language, we have the variable __LINE__ to in,dicate to us the value of the current line at runtime. In PB script we would like to get the value of the line to print it or display it , but we don't known how to do can Somebody help me ? thanks PopulateError(0, 'whatever') MessageBox('', 'line number = ' + string(Error.Line) ) On Mon, 20 Mar 2000 16:28:59 +0100, "MARDUEL" <patrick.marduel@energy.alstom.com> wrote: >in the C language, we have the variable __LINE__ to in,dicate to us the >value of the current line at ru...

trying to get started and i am getting this error
when i go to http://www.porkchopsplayground.com, i get: DotNetNuke Upgrade Error The Assembly Version ( [ASSEMBLYVERSION] ) does not match the Database Version ( [DATABASEVERSION] ) ERROR: Could not connect to database. Could not find file 'd:\hosting\nmoran26\Providers\DataProviders\AccessDataProvider\DotNetNuke.mdb'. Any suggestions will be appreciated. Thanks, Nicole Do you have a username and password set on your database? Make sure you follow the steps mentionned in the Readme.txt located in the documentation folder. In any case make sure your credentials for yo...

Getting Command line as is
Hi all, is it possible (and how) to get the command line as is, even if the parameters are separated by two or more spaces. "Colin Maharaj" <noreply@nohost.com> wrote in message news:374656@forums.embarcadero.com... > Hi all, > is it possible (and how) to get the command line > as is, even if the parameters are separated by > two or more spaces. Have you looked at the GetCommandLine() API function? http://msdn.microsoft.com/en-us/library/ms683156%28v=vs.85%29.aspx - Dennis No I did not, not until you told me but it is exactly what I wanted th...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Start With .net
hi i'm intersted to learn asp.net (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about microsoft.net with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or delphi.net) thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

Getting line number to show during editing, getting values to show during debug, getting MSDN help to know that I have it installed
G'day, Sorry I feel so dumb but these issues just push me over the edge. I've recently had to re-install VS and now none of these features that I once had now don't work.  I obviously have to tweak something but what?  It doesn't seem too obvious (I hope!)Help please!Thanks,Geoff Line numbers - that can found under Tools > Options > Text Editor > (Language) > (somewhere there, there is is a check box for line numbers) When you are in the debug mode of the IDE, go into the Debug > Windows > (whatever windows you need - locals/autos are what you're l...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework
 Table A: COUNTRY_LOOKUP COUNTRY_ID   smallintclustered, unique, primary key located on PRIMARY    COUNTRY_ID TABLE B: COUNTRY_MODE_RULES CARRIER_ID    intMODE_RULE_TYPE_ID    intORIG_COUNTRY_ID    smallintDEST_COUNTRY_ID    smallint clustered, unique, primary key located on PRIMARY    CARRIER_ID, MODE_RULE_TYPE_ID, ORIG_COUNTRY_ID, DEST_COUNTRY_IDThere is a foreign key relationship from COUNTRY_MODE_RULES to COUNTRY_LOOKUPORIG_COUNTRY_IDREFERENCES .COUNTRY_LOOKUP (COUNTRY_ID)DEST_CO...

trying to get line-by-line output of a command pipe in perl
Hello; I'm trying to obtain line-by-line output from a command pipe in perl. Unfortunately, I am firmly held to 5.8.8 version of perl on this specific machine :-( Apparently, creating an array for my command prevents me from including the final pipe symbol when trying to use the three-argument form of open when using an array for my command rather than a scalar. code snippet #1: my @cmd = ("make", "target_name", "2>&1"); open my $fh, @cmd, "|" or die "blah: $!\n"; fails, "Unknown open() mode '5'&qu...

getting started in VS2005 C# which book should I get
Hello, I am getting started with VS2005, I have use VS2003 but not very much -(I did 4 small applications in it),  I am wondering which book you would recommend to learn the new features of VS2005, while learning more of C# programing in general There some links to good books in this thread i posted : http://forums.asp.net/thread/1489422.aspx Also these two make good reference material  Professional Visual Studio 2005 (Programmer to Programmer)   Microsoft Visual Studio 2005 Unleashed  So far I recommend Wrox's C# 2005  Read the beginning chap...

ODBC gets error when CTLIB gets results
Good Day: We have a test and prod sybase v11.x server. I can make a call to the test machine OK with ODBC. ex: exec sp_name null, '123', 'XYZ', null I execute this with SQLExecDirect() This call causes execution of several other stored procedures, and a result set is returned. On the prod machine the call fails complaining about the parameters to a lower level sp. Oddly enough the same query runs fine in a non-ODBC tool on prod or test. Are there any WS or Server ODBC config parameters that would lead to this sort of thing? I know this is a bit va...

get rid of that ridiculous getting started bookmark
Name: DOCTOR Product: Firefox Summary: get rid of that ridiculous getting started bookmark Comments: Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Web resources about - get Command line scripting results! - asp.net.getting-started

Scripting News: Home Page
Scripting News, the weblog started in 1997 that bootstrapped the blogging revolution.

Talk:Cross-site scripting - Wikipedia, the free encyclopedia
This article is within the scope of WikiProject Computer Security , a collaborative effort to improve the coverage of computer security on Wikipedia. ...

Scripting language - Wikipedia, the free encyclopedia
A scripting language or script language is a programming language that supports the writing of scripts , programs written for a software environment ...

Scripting News
Scripting News: Roy Wildstein . # Scripting News: Title-less items in my feed . # Scripting News: A celebratory podcast! # Today's background ...

Scripting News: A reprieve for Google Reader readers.
I hate to hear the stories of readers who will muddle along and keep reading even though they wish there was a way to get the full text of the ...

Scripting News: He called the President 'boy'.
Just tuned into a little of the Sunday morning news discussion on various networks. The big issue seems to be whether or not VP Biden was disrespectful ...

Thread: The new River tab on Scripting.
Today there is a new tab on the Scripting News home page. Screen shot . I've felt for a long time that every serious news organization and blog ...

Scripting News: It's a good day.
Lots of good stuff today. 1. Obama won re-election. 2. He gave a great speech. 3. Romney gave a great concession speech. 4. As of today, ...

Scripting News: Election almanac e-book?
It would be useful to have an e-book you could buy for say $10 put out by a reputable news organization, that gathers, in book form, all the ...

Scripting News: The world is socialist, part II.
I try to save big ideas for January 1, every year. Hard things to write, things that take a while to think about, both as ideas, and how I want ...

Resources last updated: 1/14/2016 7:09:07 AM