@echo off :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: 先列舉存在的分區(qū),然后再逐個(gè)刪除以分區(qū)名命名的共享; :: 通過(guò)修改注冊(cè)表防止admin$共享在下次開機(jī)時(shí)重新加載; :: IPC$共享需要administritor權(quán)限才能成功刪除 :: :: jm 改動(dòng)于 2006-5-12 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
title 默認(rèn)共享刪除器 color 1f echo. echo ------------------------------------------------------ echo. echo 開始刪除每個(gè)分區(qū)下的默認(rèn)共享. echo. for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do @( if exist %%a:/nul ( net share %%a$ /delete>nul 2>nul && echo 成功刪除名為 %%a$ 的默認(rèn)共享 || echo 名為 %%a$ 的默認(rèn)共享不存在 ) ) net share admin$ /delete>nul 2>nul && echo 成功刪除名為 admin$ 的默認(rèn)共享 || echo 名為 admin$ 的默認(rèn)共享不存在 echo. echo ------------------------------------------------------ echo. net stop Server /y>nul 2>nul && echo Server服務(wù)已停止. net start Server>nul 2>nul && echo Server服務(wù)已啟動(dòng). echo. echo ------------------------------------------------------ echo. echo 修改注冊(cè)表以更改系統(tǒng)默認(rèn)設(shè)置. echo. echo 正在創(chuàng)建注冊(cè)表文件. echo Windows Registry Editor Version 5.00> c:/delshare.reg :: 通過(guò)注冊(cè)表禁止Admin$共享,以防重啟后再次加載 echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/lanmanserver/parameters]>> c:/delshare.reg echo "AutoShareWks"=dword:00000000>> c:/delshare.reg echo "AutoShareServer"=dword:00000000>> c:/delshare.reg :: 刪除IPC$共享,本功能需要administritor權(quán)限才能成功刪除 echo [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Lsa]>> c:/delshare.reg echo "restrictanonymous"=dword:00000001>> c:/delshare.reg echo 正在導(dǎo)入注冊(cè)表文件以更改系統(tǒng)默認(rèn)設(shè)置. regedit /s c:/delshare.reg del c:/delshare.reg && echo 臨時(shí)文件已經(jīng)刪除. echo. echo ------------------------------------------------------ echo. echo 程序已經(jīng)成功刪除所有的默認(rèn)共享. echo. echo 按任意鍵退出... pause>nul