Solved

use vb.net to execute shells commands

Posted on 2010-08-23
2
787 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
Comment Utility
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
Comment Utility
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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now