Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

use vb.net to execute shells commands

Posted on 2010-08-23
2
Medium Priority
?
840 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 1000 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 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 1000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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 …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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