473,441 Members | 2,568 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,441 software developers and data experts.

bump shell commands via ASP

Ok,
I tested it in VB and returns nothing. Output is nothing.
I am using impersonation (as a domain admin).
Dim p As New Process
' #tells operating system not to use a shell;
p.StartInfo.UseShellExecute = False
'#allow me to capture stdout, i.e. results
p.StartInfo.RedirectStandardOutput = True
'Say DOS Command is [EXEPath] CONNECT anotherargument
p.StartInfo.Arguments = "CONNECT anotherargument"
p.StartInfo.FileName = "qwinsta.exe"
'#do not show MSDOS window
p.StartInfo.CreateNoWindow = True
'#do it!
p.Start()
Dim _processID As System.Int32 = p.Id
'#capture results
Dim output As String = p.StandardOutput.ReadToEnd()
' this is the output from the
p.WaitForExit()
p.Close()

"Swanand Mokashi" <sw***********@swanandmokashi.com> wrote in message
news:u4**************@TK2MSFTNGP03.phx.gbl...
Here is a sample in C# -- you can use it in business layer and the output
below can be shown on the ASP.NET page

//-----------------Start

/ #start a new process

Process p = new Process();

// #tells operating system not to use a shell;

p.StartInfo.UseShellExecute = false;
//#allow me to capture stdout, i.e. results

p.StartInfo.RedirectStandardOutput = true;

//Say DOS Command is [EXEPath] CONNECT anotherargument

p.StartInfo.Arguments = "CONNECT anotherargument";

p.StartInfo.FileName =[EXEPath];

//#do not show MSDOS window

p.StartInfo.CreateNoWindow = true;

//#do it!

p.Start();

System.Int32 _processID = p.Id;

//#capture results

string output = p.StandardOutput.ReadToEnd(); // this is the output from
the command

//#wait for all results.

p.WaitForExit();

p.Close();

//-----------------End

HTH
--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...
http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"George Lake" <g@lake.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
ASP.NET

"Swanand Mokashi" <sw***********@swanandmokashi.com> wrote in message
news:eZ**************@TK2MSFTNGP05.phx.gbl...
ASP or ASP.NET ?

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"George Lake" <g@lake.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,
I need to run a few commands from the shell and display the output via
ASP (VB)

Any ideas?




May 11 '06 #1
0 1054

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

Similar topics

1
by: Bigbowser | last post by:
Hi all, I'm trying to create a sub shell environment ( i haven't really got a reason, its more of a test, although hopefully it will make life easier ;P ) but whenever i try to call the...
8
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
9
by: Amjad | last post by:
I'm trying to create a folder, append text file to another, and delete files using the "Shell" command. But I always get the error "File Not Found". How do I use DOS commands from Visual Basic?...
16
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of...
7
by: Bin Chen | last post by:
Hi, I want to do following: get a user input regex, then pass this as a parameter to grep, and then get the result from grep. Any code snip to implement the similar function? I am a python...
4
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of API. Actually I have the need for such pattern for...
1
by: Riccardo Maria Bianchi | last post by:
Hello! :) I'm trying to run shell commands both with os.system() and subprocess.Popen() class. But I can't run aliases or function defined in my .bashrc file, like in the login interactive...
1
by: raocheng | last post by:
Please see the following code. Suppose I have many shell commands to be executed. And I don't want to fork a sub shell for each command(eg: status,output = commands.getstatusoutput(cmd)) because...
5
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.