Solved

use vb.net to execute shells commands

Posted on 2010-08-23
2
821 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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