JSI Tip 10055. How can I check or uncheck the 'Show Icon in Notification area when connected' check box with a script?


Using REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the Windows 2000 Support Tools, AND the InterfaceGUID.bat subroutine, I have scripted ShowIcon.bat to check or uncheck the Show Icon in Notification area when connected  box for a network adapter.

The syntax for using ShowIcon.bat is:

ShowIcon Y|N \[LAN\]

where:

Y   will check the Show Icon in Notification area when connected box.

N   will uncheck the Show Icon in Notification area when connected box.

LAN is the optional name of your connection, like JSIINC.
    If not specified, it will default to Local Area Connection.
ShowIcon.bat contains:
@echo off
setlocal
if \{%1\}==\{\} goto ERR1
set YN=%1
if /i "%YN%" EQU "Y" set ShowIcon=1&goto OK
if /i "%YN%" NEQ "N" goto ERR1
set ShowIcon=0
:OK
set LAN="Local Area Connection"
if \{%2\} NEQ \{\} set LAN=%2
set LAN="%LAN:"=%"
Call InterfaceGUID %LAN% GUID
if "%GUID%" EQU "none" goto ERR2
set KEY=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318\}\%GUID%\Connection
call :Quiet>nul 2>&1
endlocal
goto :EOF
:Quiet
REG ADD %KEY% /V ShowIcon /T REG_DWORD /F /D %ShowIcon%
goto :EOF
:ERR1
@echo Syntax: ShowIcon Y^|N \[LAN\]
endlocal
goto :EOF
:ERR2
@echo Syntax: ShowIcon - %LAN% NOT found.
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish