Solved

use vb.net to execute shells commands

Posted on 2010-08-23
2
814 Views
Last Modified: 2013-11-27
How do I use vb,net to excute shells/DOS commands...

How would I use vb,net to open a shell command at a specific location on a directory file...then excute commands and pull data into varaibles...
0
Comment
Question by:GlobaLevel
2 Comments
 
LVL 30

Accepted Solution

by:
Brad Howe earned 250 total points
ID: 33507530
Hi,

For VB.NET and excuting command line tasks, you can use the SHELL command.

SHELL  Syntax :
shell(path_Name[,style][,wait][,timeout])
path_name = executable file with the full path of the application which it want to call
Style = a model of application window which it want to call (ex minimize,normal etc).
Wait = a boolean value that prescriptive whether shell function has to wait vb.net finish before working. false is the default value.
TimeOut = a wait time that it needful by shell function to start working if Wait in true value.

ex.
        Shell("cmd /C "C:\applicationfolder\app.exe, 0, True)

When executing commandline, you are only going to get a return code 1,0 or custom.

To get those details.

1. Can you not get this data directly through VB.NET by parsing?
2. Can you not execute this commandline task and pipe the details to a temp.txt for processing after completion?

Just some ideas,
Hades666
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 33507671
For VB.Net you use the Process() Class:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

You can redirect the StandardOutput():
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx

If you give more details then we can give specific examples...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding bootstrap to only Content page and NOT master page 1 47
Convert datetime to time string 10 28
JSON  parse help 7 40
SSIS Start 2 20
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

790 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