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
Re: Running a DOS Command WITHOUT the Command window appearing
Quote:
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?
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.
Re: Running a DOS Command WITHOUT the Command window appearing
Quote:
Originally Posted by
TheThinker
Also what does the > before the Location of the File mean?
It's called Redirection.
Re: Running a DOS Command WITHOUT the Command window appearing
Quote:
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.
Quote:
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.
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.
Re: Running a DOS Command WITHOUT the Command window appearing
Quote:
Originally Posted by
Magic Ink
That would be MD /MKDIR; note the space.
Doesn't MD and MKDIR refer to the same command?
Re: Running a DOS Command WITHOUT the Command window appearing
Quote:
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 /
Re: Running a DOS Command WITHOUT the Command window appearing
Sorry I misunderstood - you meant 'MD or MkDir' of course.