how to run a dos command in slient mode

I

iceman11

hi..

i need to map a network drive in my vb.net applcation.. is it possible
to run the dos command in a silent mode. i don't want the ms dos
window to pop up ..

thks..

iceman11
 
J

Jon

Not sure about vb.net but in vb / vbscript you can do
wshshell.run with a second argument of 0 to hide the window

eg
wshshell.run "%comspec% /c dir >>c:\DosOutput.txt",0

PS Command often seems to choke on spaces so you have to use multiple quotes
at times or put your commands into batch files

Jon
 
A

Alex Nichol

iceman11 said:
i need to map a network drive in my vb.net applcation.. is it possible
to run the dos command in a silent mode. i don't want the ms dos
window to pop up ..

Make a .bat file to run the command - and possibly use the >NUL pipe at
the end of commands so all their screen output goes to a black hole.

Make a shortcut to the .bat fie to run it with. R-click on this and
take Properties. On the Shortcut page select Run - Minimised
 
I

iceman11

Alex Nichol said:
Make a .bat file to run the command - and possibly use the >NUL pipe at
the end of commands so all their screen output goes to a black hole.

Make a shortcut to the .bat fie to run it with. R-click on this and
take Properties. On the Shortcut page select Run - Minimised

hi guys..

i have found another way to solve this...

connectdrive = Shell("net use z: \\mypc\MapImages passwd
/user:loginname", vbHide)

using the vbHide instead of vbNormalFocus will do the trick..think
that how they do it in vb.net

thks for ur help...

iceman11
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top