I have been trying to use the Shell method, but I can't seem to make the
command window activate the way you can with calc or word or notepad... It
is making it impossible to use the SendKeys function, which would be
ideal... I will take a look at the suggestion you gave me, but the Shell
looks like it would be the way to go, if I could just get the focus to the
window without errors.
The code is simple and works for everything except a DOS command window.
Dim myLng As Integer = Shell("NET SHARE tshare /DELETE",
AppWinStyle.NormalFocus)
AppActivate(myLng)
SendKeys.SendWait("y")
SendKeys.SendWait("{Enter}")
That should work and does if you substitute notepad, word, etc instead of
any DOS command, for some reason Windows cannot find the Command Window to
set focus.
I am using NET SHARE to unshare a directory on a server so that some file
maintence can be done at night, even though some users still leave their
computers attached to the share. I cannot find a /y to answer affermative
and ECHO y| doesn't work for it either, or I would be using a simple batch
file to do this.