-
Sep 1st, 2004, 01:52 PM
#1
Thread Starter
Member
Running a DOS Command WITHOUT the Command window appearing
Hi,
I want to run a DOS command from my Visual Basic program - and I can do that fine, but I want to do it without the Command Window popping up. Is there a way to do this?? because if the command window pops up it makes my app look very scruffy.
Robin
-
Sep 1st, 2004, 02:03 PM
#2
Fanatic Member
What dos commands are you trying to run? Chances are there is a windows equivalent command that you can run instead so that you dont get the command prompt.
-
Sep 1st, 2004, 02:05 PM
#3
Thread Starter
Member
I'm trying to run the ping command.
I need to get the output (I dont care about the time - I just need to know if it worked or failed) so I was thinking of doing ping 192.168.0.1 > ping.txt or summat like that.
Thanks
Robin
-
Sep 1st, 2004, 02:09 PM
#4
Thread Starter
Member
thanks for your help but I've just found a way to do ping without using the DOS Command prompt.
Thanks
RObin
-
Sep 1st, 2004, 02:12 PM
#5
New Member
Hi rob,
could you pls tell me how do you ping without using the dos command.
thanx..
-
Sep 1st, 2004, 02:14 PM
#6
Thread Starter
Member
-
Sep 1st, 2004, 02:29 PM
#7
VB Code:
Shell "cmd /k ping 127.0.0.1 >e:\ping.txt ", vbHide
But cmd is still going to be loaded as a process.
-
Sep 1st, 2004, 02:30 PM
#8
Thread Starter
Member
Hadn't noticed that! Thanks for telling me - but it works fine and I cant see the command window!
Thanks
Robin
-
Sep 2nd, 2004, 08:57 AM
#9
FYI I hear WinXP SP2 turns off response to a PING request so it seems PING is becoming less useful thanks to M$.
-
Dec 5th, 2012, 10:37 AM
#10
Member
Re: Running a DOS Command WITHOUT the Command window appearing
Originally Posted by Jmacp
VB Code:
Shell "cmd /k ping 127.0.0.1 >e:\ping.txt ", vbHide
But cmd is still going to be loaded as a process.
I was searching how to do this for quite some time... I was about to create a thread too..
Thanks a lot...
It'd be great if you could elaborate what /k is.
Also what does the > before the Location of the File mean?
Last edited by TheThinker; Dec 5th, 2012 at 11:15 AM.
-
Dec 5th, 2012, 04:49 PM
#11
Re: Running a DOS Command WITHOUT the Command window appearing
>elaborate what /k is
Open a Command (cmp) prompt window; type in cmd /? and press Return; it will provide help for the options for the cmd command
I suggest it may be preferrable to use the /C option, otherwise you may end up with an invisible Command prompt window/ process (each time you do the call) and that (all of them) will remain until the computer is restarted.
-
Dec 6th, 2012, 06:16 AM
#12
Re: Running a DOS Command WITHOUT the Command window appearing
Originally Posted by TheThinker
Also what does the > before the Location of the File mean?
It's called Redirection.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Dec 6th, 2012, 06:55 AM
#13
Member
Re: Running a DOS Command WITHOUT the Command window appearing
Originally Posted by Magic Ink
Open a Command (cmp) prompt window; type in cmd /? and press Return; it will provide help for the options for the cmd command
I suggest it may be preferrable to use the /C option, otherwise you may end up with an invisible Command prompt window/ process (each time you do the call) and that (all of them) will remain until the computer is restarted.
Originally Posted by Bonnie West
So If i want to output the file to a folder tat doesn't exist, I'll have to create the Folder via MD/MKDIR
Right?
Thanks a lot.
-
Dec 6th, 2012, 07:09 AM
#14
Re: Running a DOS Command WITHOUT the Command window appearing
That would be MD /MKDIR; note the space.
However vb has the MkDir Statement so you do not need to do it via the Command (cmd) window.
-
Dec 6th, 2012, 07:56 AM
#15
Re: Running a DOS Command WITHOUT the Command window appearing
Originally Posted by Magic Ink
That would be MD /MKDIR; note the space.
Doesn't MD and MKDIR refer to the same command?
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Dec 7th, 2012, 02:34 AM
#16
Member
Re: Running a DOS Command WITHOUT the Command window appearing
Originally Posted by Bonnie West
Doesn't MD and MKDIR refer to the same command?
Yes it does... Which is why I made use of the /
-
Dec 7th, 2012, 04:37 AM
#17
Re: Running a DOS Command WITHOUT the Command window appearing
Sorry I misunderstood - you meant 'MD or MkDir' of course.
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
|