| | |
how to call command window with VB.NET programme
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2007
Posts: 19
Reputation:
Solved Threads: 0
hi,
i want to integrate VB.NET with command window.
in fact, i want the interface(built on VB.NET) to open the command window and it should automatically change the path to C:\Perl\eg and then it has to execute automatically the file what i specified. for this i already used the code given below .
Shell("cmd.exe /k cd C:\Perl\eg", vbNormalFocus)
when i add this code, its opening the command window and the path is changed to C:\Perl\eg. but i need to type the below command on command prompt after changing the path to execute the perl code.
ex: perl filename.pl
But i want the above command to be executed automatically not manually. For that i've to add that command somewhere in VB.NET. But i don't know where to add and how to add exactly.
i hope somebody helps with this as early as possible.
thank u.
chandrag
i want to integrate VB.NET with command window.
in fact, i want the interface(built on VB.NET) to open the command window and it should automatically change the path to C:\Perl\eg and then it has to execute automatically the file what i specified. for this i already used the code given below .
Shell("cmd.exe /k cd C:\Perl\eg", vbNormalFocus)
when i add this code, its opening the command window and the path is changed to C:\Perl\eg. but i need to type the below command on command prompt after changing the path to execute the perl code.
ex: perl filename.pl
But i want the above command to be executed automatically not manually. For that i've to add that command somewhere in VB.NET. But i don't know where to add and how to add exactly.
i hope somebody helps with this as early as possible.
thank u.
chandrag
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Try this in your main form load event:
Without the With statement:
Read up on the Process function. Can do a lot more than Shell. Like redirect the output to a textbox so you don't have to remember what the dos screen said.
VB.NET Syntax (Toggle Plain Text)
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim process As New Process With process With .StartInfo .FileName = "perl.exe" .Arguments = "filename.pl" .WorkingDirectory = "C:\Perl\eg" End With .Start() End With End Sub
Without the With statement:
VB.NET Syntax (Toggle Plain Text)
Dim process As New Process process.StartInfo.FileName = "perl.exe" process.StartInfo.Arguments = "filename.pl" process.StartInfo.WorkingDirectory = "C:\Perl\eg" process.Start()
Read up on the Process function. Can do a lot more than Shell. Like redirect the output to a textbox so you don't have to remember what the dos screen said.
Last edited by waynespangler; Jul 21st, 2007 at 10:10 am.
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
•
•
Join Date: Jul 2007
Posts: 19
Reputation:
Solved Threads: 0
•
•
•
•
Try this in your main form load event:
VB.NET Syntax (Toggle Plain Text)
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim process As New Process With process With .StartInfo .FileName = "perl.exe" .Arguments = "filename.pl" .WorkingDirectory = "C:\Perl\eg" End With .Start() End With End Sub
Without the With statement:
VB.NET Syntax (Toggle Plain Text)
Dim process As New Process process.StartInfo.FileName = "perl.exe" process.StartInfo.Arguments = "filename.pl" process.StartInfo.WorkingDirectory = "C:\Perl\eg" process.Start()
Read up on the Process function. Can do a lot more than Shell. Like redirect the output to a textbox so you don't have to remember what the dos screen said.
tremendous. thank u very much for ur help.
it is working. excellent.
thank u very very much once again.
and one more thing is that i want that result to be shown in my interface. what to do for that?
thank u
chandrag
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Try this:
VB.NET Syntax (Toggle Plain Text)
Dim process As New Process process.StartInfo.FileName = "perl.exe" process.StartInfo.Arguments = "filename.pl" process.StartInfo.WorkingDirectory = "C:\Perl\eg" process.StartInfo.UseShellExecute = False process.StartInfo.ErrorDialog = False process.StartInfo.RedirectStandardOutput = True process.Start() TextBox1.Text = process.StandardOutput.ReadToEnd process.WaitForExit()
Last edited by waynespangler; Jul 23rd, 2007 at 10:56 am.
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
•
•
Join Date: Jul 2007
Posts: 19
Reputation:
Solved Threads: 0
•
•
•
•
Try this:
VB.NET Syntax (Toggle Plain Text)
Dim process As New Process process.StartInfo.FileName = "perl.exe" process.StartInfo.Arguments = "filename.pl" process.StartInfo.WorkingDirectory = "C:\Perl\eg" process.StartInfo.UseShellExecute = False process.StartInfo.ErrorDialog = False process.StartInfo.RedirectStandardOutput = True process.Start() TextBox1.Text = process.StandardOutput.ReadToEnd process.WaitForExit()
i tried it. but there is no result.
it's opening the command window. but it's not executing anything.
it's not closing as well. and it's not giving any result in text box.
chandrag
•
•
Join Date: Jul 2007
Posts: 19
Reputation:
Solved Threads: 0
•
•
•
•
hi,
i tried it. but there is no result.
it's opening the command window. but it's not executing anything.
it's not closing as well. and it's not giving any result in text box.
chandrag
i've got it. it's working.
thak u very much. earlier i was closing when it was in process.
but now i waited for some time and got the result. thank u so much for ur kind help.
thank u once again.
chandrag
![]() |
Similar Threads
- calling command prompt with VB.NET (VB.NET)
- How to Prevent Command Window from Appearing (C++)
- Dont want to display command window (Java)
Other Threads in the VB.NET Forum
Views: 10284 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center checkbox class client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms generatetags gridview html images input intel internet lib listview map mobile monitor net number objects open panel pdf picturebox picturebox2 port position print printing problem read remove richtextbox save searchvb.net select serial settings shutdown socket sorting sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter user usercontol validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode year






