|
-
Mar 28th, 2007, 07:47 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Command shel Help for VB studio[2005] I HOPE ITS POSSIBLE!!!!!!!!!!!!!
Hi, I'm fairly new to vb 2005 but am very good with vb6... so my main question is how do I send dos commands to the computer without having the user open any command prompts. SO example I would like to execute this command from my program...
EX: C:\>IpConfig
and of course all the output would be shown... This program will be only to show your ip and other dos command tasks. It has to be dos and no other method PLEASE. I need it to be able to communicate with dos like a command prompt. Thanks for viewing my post and hope any of you experts could help me out with this tricky yet fun task.
Coding's a Breeze if you'r at ease! GOD THATS CORNY!!
 - 
-
Mar 28th, 2007, 08:06 PM
#2
Lively Member
Re: Command shel Help for VB studio[2005] I HOPE ITS POSSIBLE!!!!!!!!!!!!!
well....you can still use Shell(stringCommand) like before...but as far as actually showing the result, i'm not sure.
-
Mar 28th, 2007, 08:08 PM
#3
Re: Command shel Help for VB studio[2005] I HOPE ITS POSSIBLE!!!!!!!!!!!!!
Depending on the amount of control, you could use ProcessStartInfo to execute a command prompt window passing the dos arguments.
The /C means to close the command window when complete. /K would mean to keep it open.
vb Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oPSI As New System.Diagnostics.ProcessStartInfo
With oPSI
.FileName = "C:\Windows\System32\cmd.exe"
.CreateNoWindow = True
.WindowStyle = ProcessWindowStyle.Hidden
.WorkingDirectory = "C:\Users\VB-Guru\"
.UseShellExecute = True
.Arguments = "/C Ping google.com > PingResults.txt"
End With
System.Diagnostics.Process.Start(oPSI)
End Sub
Last edited by RobDog888; Mar 28th, 2007 at 08:13 PM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 28th, 2007, 08:20 PM
#4
Thread Starter
Hyperactive Member
Re: Command shel Help for VB studio[2005] I HOPE ITS POSSIBLE!!!!!!!!!!!!!
Thank you verry much for the quick responce time.... RobDog888 your code did exactly what i was looking for and thank you very much.
Coding's a Breeze if you'r at ease! GOD THATS CORNY!!
 - 
-
Mar 28th, 2007, 08:21 PM
#5
Re: Command shel Help for VB studio[2005] I HOPE ITS POSSIBLE!!!!!!!!!!!!!
No prob. Glad to help. 
I added an enhancement for opening the textfile (optional) when its done processing.
vb Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oPSI As New System.Diagnostics.ProcessStartInfo
Dim oProcess As System.Diagnostics.Process
With oPSI
.FileName = "C:\Windows\System32\cmd.exe"
.CreateNoWindow = True
.WindowStyle = ProcessWindowStyle.Hidden
.WorkingDirectory = "C:\Users\VB-Guru\"
.UseShellExecute = True
.Arguments = "/C Ping google.com > PingResults.txt"
End With
oProcess = System.Diagnostics.Process.Start(oPSI)
oProcess.WaitForExit()
System.Diagnostics.Process.Start(oPSI.WorkingDirectory & "PingResults.txt")
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 29th, 2007, 03:43 PM
#6
Thread Starter
Hyperactive Member
Re: Command shel Help for VB studio[2005] I HOPE ITS POSSIBLE!!!!!!!!!!!!!
Coding's a Breeze if you'r at ease! GOD THATS CORNY!!
 - 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|