Using REG.EXE, built into Windows XP, Windows Server 2003, Windows Vista, and later operating systems, or installed from the Windows 2000 Support Tools, I have scripted ShowDesktopIcons.bat to show or hide the My Documents and/or My Computer and/or My Network Places and/or Internet Explorer desktop icons.

The syntax for using ShowDesktopIcons.bat is:

\[call\] ShowDesktopIcons MyDocuments MyComputer MyNetworkPlaces InternetExplorer

Where:

<b>MyDocuments</b>       - is an <b>H</b> to hide the <b>My Documents</b> icon or an <b>S</b> to show it.
<b>MyComputer</b>        - is an <b>H</b> to hide the <b>My Computer</b> icon or an <b>S</b> to show it.
<b>MyNetworkPlaces</b>   - is an <b>H</b> to hide the <b>My Network Places</b> icon or an <b>S</b> to show it.
<b>InternetExplorer</b>  - is an <b>H</b> to hide the <b>Internet Explorer</b> icon or an <b>S</b> to show it.
NOTE: After running ShowDesktopIcons.bat, you must select the desktop and press F5 to refresh the display.

ShowDesktopIcons.bat contains:

@echo off
If \{%4\}<h1><a name="_echo_Syntax_ShowDesktopIcons_MyDocuments_MyComputer_MyNetworkPlaces_InternetExplorer_amp_goto_EOF_setlocal_If_4_">\{\} @echo Syntax ShowDesktopIcons MyDocuments MyComputer MyNetworkPlaces InternetExplorer&goto :EOF
setlocal
If \{%4\}</a></h1>\{\} @echo Syntax ShowDesktopIcons MyDocuments MyComputer MyNetworkPlaces InternetExplorer&endlocal&goto :EOF
set MyDocuments=%1
set MyComputer=%2
set MyNetworkPlaces=%3
set InternetExplorer=%4
if /i "%MyDocuments%" EQU "H" set MyDocuments=1&goto tMC
if /i "%MyDocuments%" EQU "S" set MyDocuments=0&goto tMC
@echo Syntax ShowDesktopIcons - My Documents NOT S or H&endlocal&goto :EOF
:tMC
if /i "%MyComputer%" EQU "H" set MyComputer=1&goto tMN
if /i "%MyComputer%" EQU "S" set MyComputer=0&goto tMN
@echo Syntax ShowDesktopIcons - My Computer NOT S or H&endlocal&goto :EOF
:tMN
if /i "%MyNetworkPlaces%" EQU "H" set MyNetworkPlaces=1&goto tIE
if /i "%MyNetworkPlaces%" EQU "S" set MyNetworkPlaces=0&goto tIE
@echo Syntax ShowDesktopIcons - My NetworkPlaces NOT S or H&endlocal&goto :EOF
:tIE
if /i "%InternetExplorer%" EQU "H" set InternetExplorer=1&goto tOK
if /i "%InternetExplorer%" EQU "S" set InternetExplorer=0&goto tOK
@echo Syntax ShowDesktopIcons - Internet Explorer NOT S or H&endlocal&goto :EOF
:tOK
call :quiet >Nul 2>&1
endlocal
goto :EOF
:quiet
set CV="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu"
set XV="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"
REG ADD %CV% /V \{450D8FBA-AD25-11D0-98A8-0800361B1103\} /T REG_SZ /F /D %MyDocuments%
REG ADD %XV% /V \{450D8FBA-AD25-11D0-98A8-0800361B1103\} /T REG_SZ /F /D %MyDocuments%
REG ADD %CV% /V \{20D04FE0-3AEA-1069-A2D8-08002B30309D\} /T REG_SZ /F /D %MyComputer%
REG ADD %XV% /V \{20D04FE0-3AEA-1069-A2D8-08002B30309D\} /T REG_SZ /F /D %MyComputer%
REG ADD %CV% /V \{208D2C60-3AEA-1069-A2D7-08002B30309D\} /T REG_SZ /F /D %MyNetworkPlaces%
REG ADD %XV% /V \{208D2C60-3AEA-1069-A2D7-08002B30309D\} /T REG_SZ /F /D %MyNetworkPlaces%
REG ADD %CV% /V \{871C5380-42A0-1069-A2EA-08002B30309D\} /T REG_SZ /F /D %InternetExplorer%
REG ADD %XV% /V \{871C5380-42A0-1069-A2EA-08002B30309D\} /T REG_SZ /F /D %InternetExplorer%