天天看點

[轉]區域網路共享一鍵修複 18.5.8 https://zhuanlan.zhihu.com/p/24178142

@echo off

color 2f

mode con cols=50 lines=30

title OKShare 【制作:wnsdt】

ver | findstr "6.">nul && set bulid=nt6 && goto sc_yhbl

ver | findstr "10.">nul && set bulid=nt10 && goto sc_yhbl

set bulid=nt5

:sc_yhbl

reg query "HKCU\Environment" /v temp >nul 2>nul||set "usertemp=%USERPROFILE%\" && goto sc_top

set usertemp=%temp%\

:sc_top

cls

del /q %temp%\info.txt>nul 2>nul

:sc_menu

echo.&echo.&echo.

echo 區域網路共享一鍵修複 18.5.8

echo.

echo --------------------------------------------

echo 1、檢視網絡資訊

echo 2、簡單共享(無密碼)

echo 3、密碼共享

echo 4、共享和權限管理

echo 5、權限設定指南(圖文)

echo 6、列印機共享指南(圖文)

echo 7、更新與回報

echo.&echo.&echo.&echo.&echo.

set select=

set str1=1234567

set /p select= 輸入數字,按回車:

if not defined select goto sc_wrong

echo %select%|findstr "[%str1%]">nul||goto sc_wrong

if %select%==1 (goto sc_info)

if %select%==2 (goto sc_zd)

if %select%==3 (goto sc_sd)

if %select%==4 (goto sc_gl)

if %select%==5 (goto sc_help)

if %select%==6 (goto sc_print)

if %select%==7 (goto sc_update)

:sc_wrong

mshta vbscript:msgbox("隻能輸入1-7的數字",64,"提示")(window.close)

goto sc_top

:sc_info

echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.

echo 正在處理資訊....

if %bulid%==nt5 (goto sc_nt5) else (goto sc_nt6)

:sc_nt5

(echo.

echo.)>>%usertemp%info.txt

ping www.baidu.com -n 1 >nul || echo 網際網路狀态: [ 離線 ]>>%usertemp%info.txt && goto sc_ver_nt5

echo 網際網路狀态: [ 線上 ]>>%usertemp%info.txt

:sc_ver_nt5

(echo ----------------------------------------------------------

for /f "skip=1 tokens=2-4 delims=, " %%a in ('wmic os get caption') do (

if exist %windir%\SysWOW64 echo 系統版本: %%a %%b %%c 64位>>%usertemp%info.txt & goto sc_ver_nt5_next

echo 系統版本: %%a %%b %%c 32位>>%usertemp%info.txt

)

:sc_ver_nt5_next

echo 計算機名: %COMPUTERNAME%

for /f "tokens=2 delims= " %%a in ('net config workstation^|findstr /c:"工作站域"') do echo 工作組: %%a>>%usertemp%info.txt & goto sc_info_nt5

:sc_info_nt5

echo 目前使用者: %USERNAME%

for /f "delims=" %%a in ('date /t') do echo 本機日期: %%a>>%usertemp%info.txt

echo.>>%usertemp%info.txt

for /f "delims=" %%a in ('time /t') do echo 本機時間: %%a>>%usertemp%info.txt

echo ---------------------------------------------------------->>%usertemp%info.txt

goto sc_info_more

:sc_nt6

ping www.baidu.com -n 1 >nul || echo 網際網路狀态: [ 離線 ]>>%usertemp%info.txt && goto sc_ver_nt6

echo 網際網路狀态: [ 線上 ]>>%usertemp%info.txt

:sc_ver_nt6

(echo --------------------------------------------------

for /f "skip=1 tokens=2-5 delims=?, " %%a in ('wmic os get caption') do (

if exist %windir%\SysWOW64 echo 系統版本: %%a %%b %%c %%d 64位>>%usertemp%info.txt & goto sc_ver_nt6_next

echo 系統版本: %%a %%b %%c %%d 32位>>%usertemp%info.txt

:sc_ver_nt6_next

echo 計算機名: %COMPUTERNAME%

for /f "tokens=2 delims= " %%a in ('net config workstation^|findstr /c:"工作站域"') do echo 工作組: %%a>>%usertemp%info.txt

echo 目前使用者: %USERNAME%

for /f "delims=" %%a in ('date /t') do echo 本機日期: %%a>>%usertemp%info.txt

for /f "delims=" %%a in ('time /t') do echo 本機時間: %%a>>%usertemp%info.txt

echo -------------------------------------------------->>%usertemp%info.txt

:sc_info_more

if %bulid%==nt5 ipconfig /all|findstr /v /c:"Windows IP Configuration"|findstr /v /c:"Host Name"|findstr /v /c:"Primary Dns Suffix"|findstr /v /c:"Node Type"|findstr /v /c:"IP Routing Enabled"|findstr /v /c:"WINS Proxy Enabled">>%usertemp%info.txt && goto sc_info_next

ipconfig /all|findstr /v /c:"Windows IP 配置"|findstr /v /c:"主機名"|findstr /v /c:"主 DNS 字尾"|findstr /v /c:"節點類型"|findstr /v /c:"IP 路由已啟用"|findstr /v /c:"WINS 代理已啟用">>%usertemp%info.txt

:sc_info_next

start /w notepad %temp%\info.txt

:sc_zd

call :sc_qxfix

echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.

echo 開始修複......

net user guest /active:yes>nul 2>nul

net user guest "">nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x1 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0x0 /f>nul 2>nul

goto sc_main

:sc_sd

net user guest /active:no>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x0 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v NtlmMinClientSec /t REG_DWORD /d 0x0 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v NtlmMinServerSec /t REG_DWORD /d 0x0 /f>nul 2>nul

:sc_main

sc config LanmanWorkstation start= auto>nul 2>nul

sc config LanmanServer start= auto>nul 2>nul

sc config Winmgmt start= auto>nul 2>nul

sc config RpcSs start= auto>nul 2>nul

sc config Netman start= auto>nul 2>nul

sc config RasMan start= demand>nul 2>nul

sc config SSDPSRV start= auto>nul 2>nul

sc config BFE start= auto>nul 2>nul

sc config ALG start= demand>nul 2>nul

sc config SharedAccess start= auto>nul 2>nul

net start SharedAccess /y>nul 2>nul

sc config Browser start= auto>nul 2>nul

net start Browser /y>nul 2>nul

sc config Dnscache start= auto>nul 2>nul

net start Dnscache /y>nul 2>nul

sc config Dhcp start= auto>nul 2>nul

net start Dhcp /y>nul 2>nul

sc config lmhosts start= auto>nul 2>nul

net start lmhosts /y>nul 2>nul

sc config Spooler start= auto>nul 2>nul

net start Spooler /y>nul 2>nul

sc config upnphost start= demand>nul 2>nul

net start upnphost /y>nul 2>nul

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Netlogon" /v Start|findstr "0x4">nul 2>nul && sc config Netlogon start= demand>nul 2>nul

reg add "HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v TransportBindName /t REG_SZ /d \Device\ /f>nul 2>nul

reg delete "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB1 /F>nul 2>nul

reg delete "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB2 /F>nul 2>nul

reg delete "HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v SMBDeviceEnabled /F>nul 2>nul

sc config netbt start= system>nul 2>nul

net start netbt>nul 2>nul

if %bulid%==nt5 (goto sc_sernt5) else (goto sc_sernt6)

:sc_sernt5

sc config PlugPlay start= auto>nul 2>nul

sc config TapiSrv start= auto>nul 2>nul

sc config Nla start= auto>nul 2>nul

net start Nla /y>nul 2>nul

netsh firewall set opmode mode=disable>nul 2>nul

goto sc_main2_etc

:sc_sernt6

sc config DcomLaunch start= auto>nul 2>nul

sc config RpcEptMapper start= auto>nul 2>nul

sc config SamSs start= auto>nul 2>nul

sc config nsi start= auto>nul 2>nul

sc config SstpSvc start= demand>nul 2>nul

sc config MpsSvc start= auto>nul 2>nul

net start MpsSvc /y>nul 2>nul

sc config NlaSvc start= auto>nul 2>nul

sc config netprofm start= auto>nul 2>nul

sc config fdPHost start= auto>nul 2>nul

net start fdPHost /y>nul 2>nul

sc config FDResPub start= auto>nul 2>nul

net start FDResPub /y>nul 2>nul

sc config HomeGroupListener start= auto>nul 2>nul

sc config WMPNetworkSvc start= auto>nul 2>nul

net start WMPNetworkSvc /y>nul 2>nul

sc config HomeGroupProvider start= auto>nul 2>nul

net start HomeGroupProvider /y>nul 2>nul

netsh advfirewall set allprofiles state off>nul 2>nul

:sc_main2_etc

(echo [Unicode]

echo Unicode=yes

echo [Version]

echo signature="$CHICAGO$"

echo Revision=1

echo [Privilege Rights]

echo sedenynetworklogonright =

echo senetworklogonright = Everyone,Administrators,Users,Power Users,Backup Operators,guest)>>%usertemp%zcl.inf

secedit /configure /db %usertemp%zcl.sdb /cfg %usertemp%zcl.inf /log %usertemp%zcl.log /quiet

del /q %usertemp%zcl.*>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v LmCompatibilityLevel /t REG_DWORD /d 0x1 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 0x0 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymoussam /t REG_DWORD /d 0x0 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v everyoneincludesanonymous /t REG_DWORD /d 0x1 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v NoLmHash /t REG_DWORD /d 0x0 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 0x1 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v AutoShareWks /t REG_DWORD /d 0x1 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v restrictnullsessaccess /t REG_DWORD /d 0x0 /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v MaintainServerList /t REG_SZ /d Auto /f>nul 2>nul

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v IsDomainMaster /t REG_SZ /d FALSE /f>nul 2>nul

for /f "delims=" %%a in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces" /s /e /f "0x2"^|findstr "\Tcpip_"') do reg add "%%a" /v NetbiosOptions /t REG_DWORD /d 0x0 /f>nul 2>nul

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v EnableLMHOSTS|findstr "0x0">nul 2>nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v EnableLMHOSTS /t REG_DWORD /d 0x1 /f>nul 2>nul

reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" /f>nul 2>nul

net use * /del /y>nul 2>nul

net config server /hidden:no>nul 2>nul

net share ipc$>nul 2>nul

if %bulid%==nt10 powershell -NonInteractive "Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol">nul 2>nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v AllowInsecureGuestAuth /t REG_DWORD /d 0x1 /f>nul 2>nul

goto sc_tip

:sc_gl

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest|findstr "0x1">nul 2>nul||goto classic

set jlb=y

:classic

echo.&echo.&echo.&echo.

echo 功能:管理本機共享,修改共享權限

echo ----------------------------------------------

echo 【使用說明】

echo.&echo.

echo 點左側“共享”可檢視本機所有共享;

echo 右鍵點左側“共享”可“建立共享”;

echo 右鍵點右側共享可“停止共享”(能多選);

echo 右鍵點右側共享選“屬性”可修改權限;

echo.&echo.&echo.&echo.&echo.&echo.&echo.

fsmgmt.msc

if %jlb%==y reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x1 /f>nul 2>nul

:sc_tip

echo 修複已完成!!!

mshta vbscript:msgbox("請手動重新開機計算機",64,"提示")(window.close)

exit

:sc_help

start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24285252"

:sc_print

start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24187152"

:sc_update

start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24178142"

goto :eof

:sc_qxfix

echo 【使用說明】

echo 複制共享檔案夾的位址欄路徑到下方

echo 如果隻共享列印機,按Enter鍵跳過

echo 粘貼路徑,按回車:

set /p lj=

for %%a in ("%lj%") do set name=%%~na

net share "%name%"="%lj%">nul 2>nul

if %bulid%==nt5 cacls "%lj%" /t /e /p everyone:f >nul 2>nul && goto :eof

icacls "%lj%" /grant everyone:(oi)(ci)f>nul 2>nul