Home / Software / Computer programming / help with VB.net shell command
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: help with VB.net shell command  (Read 1522 times)
blastman
Topic Starter
Hopeful



Posts: 303


« on: August 26, 2007, 01:36:31 PM »

hey all,

I've written a program in VB.net.

Most of the commands it runs are in dos and VB calls the relevent batch files to complete.

I'm looking for the command to pop a "  messagebox.show ("Commands Completed")  " message once the the batch file has finished.

My mate saids there is an extention that goes on the end of the shell command below;

(whole form)

Public Class Formecho

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttechorun.Click
        Dim printerChoice As String

        If RadButHp.Checked = True Then
            printerChoice = "b"
        Else
            printerChoice = "a"

        End If
        Shell("\\swnfs01\home\blastman\batch\new\echo.bat " + printerChoice + " " + ipDetails.Text)       
        'MessageBox.Show("Echo Commands Completed")

    End Sub

    Private Sub Formecho_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub


any ideas????

maybe somthing in the bacth to say it's finished is needed??

cheers.
IP logged


Blastman, you are the man. Thank You Very Much!!!!!!!!!


Sidewinder
Guru



Thanked: 97
Posts: 4,342

Experience: Familiar
OS: Windows 7

« Reply #1 on: August 27, 2007, 06:29:42 PM »

I found this in the documentation:

Quote
Tools.Shell [/command] [/output] [/dir:folder] path [args]

Example:
Quote
ProcID = Shell("CALC.EXE", AppWinStyle.NormalFocus)

Is this the same project from last week? I still think a VB.Net program is overkill for your project, but shelling out of VB.Net to run batch files with the inherent overhead of the cmd processor is a bit counterproductive. A better approach might be using native VB.Net code to do the work of the batch files.

If I remember correctly, you needed a GUI. You can develop a HTA which would combine VBScript for the window event handlers, drive mapping and file copying with some HTML code for the GUI controls. The unit runs as a script in Windows and does not require the services of a browser. This is a more down and dirty approach than VB.Net but with rapid development and easier maintenance.

You can read about HTML applications at the HTA Developers Center

Good luck. 8)
« Last Edit: August 27, 2007, 06:43:41 PM by Sidewinder » IP logged

If you don't know where you are going, any road will get you there

                                                                            -Lewis Carroll
ghostdog74
Mentor



Thanked: 26
Posts: 1,511


« Reply #2 on: August 27, 2007, 07:51:17 PM »

my advice...try to do eveything in VB.net...if possible..look at the batch file and see if you can redesign your code to an VB equivalent...i believe in VB, you can use open to read your ipdetails.txt files and do something about it...$0.02
IP logged

blastman
Topic Starter
Hopeful



Posts: 303


« Reply #3 on: August 30, 2007, 03:18:38 AM »

cheers for the post's guys,

and yes this is still the same project. ::)

I have around 12 functions for this to carry out. These include sending "shutdown", starting pstools, re starting services and pinging other Pc's.

It will help support over 2000 machines and will have a database of IP addresses, so the user only need enter a store number (5 digit's) and ping all Pc's on that site's IP range

I do intend to convert the batch files into VB.net at some point but because this is my first real project I'm taking it one step at a time. I had already written all of the batch files and used them my self but "for the greater good" I'm making something more usable for everyone else.

I have since posting this been advised by a friend that i can have a status window which displays the last lines of the batch file. This works well but i now have the problem that i need VB.net to write a batch file with   user inputted values inserted so that status can just run one batch file with no added " + values +)

I'll have a hunt around......
IP logged


Blastman, you are the man. Thank You Very Much!!!!!!!!!


Pages: [1] - (Top) Print 
Home / Software / Computer programming / help with VB.net shell command « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.094 seconds with 20 queries.