View Single Post
  #44  
Old July 21st 09, 10:00 PM posted to microsoft.public.windowsxp.network_web,microsoft.public.windowsxp.general
No_Name
external usenet poster
 
Posts: 119
Default Ethernet adapter interfering with Mouse

On Jul 21, 4:27*pm, "Pegasus [MVP]" wrote:
*** See below.

wrote in message

...

Here is the experimental script that I used. *I basically just moved
the ping to the beginning of the subroutine, as a test to see if the
"call" command would block or not. *According to the documentation,
the script is supposed to continue executing without waiting for the
call command to finish
*** I do not know what documentation you refer to but whatever
*** it is, it is incorrect. The ping command I used will cause the
*** batch file to pause unconditionally.

so that means we should see the "Entering Sub"
line printed out twice immediately. *But when I run it, I see
"Entering Sub", followed by a 9 second pause, followed by "Exiting
Sub" and then "Entering Sub", followed by a 9 second pause and then
"Exiting Sub".
*** This is exactly what I expected.

So based on that behavior, it would seem that the ping
command isn't necessary at all in the script.
*** I introduced the ping command because I did not know
*** whether you needed to keep your NIC off for a few
*** seconds. I alluded to this in my second response. The
*** interrupt problem you report is fairly bizarre, hence
*** the work-around may need to do some bizarre things too . . .

It seems to work fine without it.
*** Great!
But now I'm confused about when the call command is
blocking and when it is non-blocking.
*** The subroutine disables the NIC when invoked with a "disable"
*** parameter and vice versa. Furthermore it tells you what it does
*** when you invoke it from a Command Prompt or if you add
*** a Pause command like so:
call :Sub disable
call :Sub enable
pause
goto :eof
*** or perhaps like so:
call :Sub disable
call :Sub enable
ping localhost -n 5 nul
goto :eof


Here is the documentation I found for the call command:
http://www.microsoft.com/resources/d....mspx?mfr=true

It says: "Calls one batch program from another without stopping the
parent batch program." So it sounds like each "call" command will, in
effect, start a separate thread. So the main program would launch the
subroutine with the "disable" parameter, and then it would immediately
launch the subroutine again with the "enable" parameter, and you'd be
trying to disable and enable the network adapter at the same time.
That's why I thought the ping command to simulate a sleep was
necessary, to force the enable function to be performed after the
disable function was finished. But the behavior I am noticing seems
to indicate that a sleep isn't necessary, and that contradicts the
documentation.
Ads