1.

Solve : help with VB.net shell command?

Answer»

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.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. 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.02cheers 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......


Discussion

No Comment Found