设为首页收藏本站 |天气与日历| 2025-07-01 星期二 22:19:00 (建党节) 乙巳(蛇)年 六月初七 亥时
     
切换到窄版

私人站点

 找回密码
 立即注册
搜索
查看: 317|回复: 0

一键共享设置BAT脚本

[复制链接]

954

主题

954

帖子

3879

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3879
发表于 2021-10-26 22:32:17 | 显示全部楼层 |阅读模式
  1. @echo off
  2. color 2f
  3. mode con cols=50 lines=30
  4. title  OKShare  【制作:wnsdt】
  5. ver | findstr "5.">nul || set bulid=nt6 && goto sc_yhbl
  6. set bulid=nt5
  7. :sc_yhbl
  8. reg query "HKCU\Environment" /v temp >nul 2>nul||set "usertemp=%USERPROFILE%" && goto sc_top
  9. set usertemp=%temp%\
  10. :sc_top
  11. cls
  12. del /q %temp%\info.txt>nul 2>nul
  13. :sc_menu
  14. echo.&echo.&echo.
  15. echo             局域网共享一键修复 17.9.11
  16. echo.
  17. echo    --------------------------------------------
  18. echo.&echo.&echo.
  19. echo               1、查看网络信息
  20. echo.
  21. echo               2、简单共享(无密码)
  22. echo.
  23. echo               3、密码共享
  24. echo.
  25. echo               4、共享和权限设置
  26. echo.
  27. echo               5、设置权限指南(图文)
  28. echo.
  29. echo               6、打印机共享指南(图文)
  30. echo.
  31. echo               7、软件更新与反馈
  32. echo.&echo.&echo.&echo.&echo.
  33. set select=
  34. set str1=1234567
  35. set /p select= 输入数字,按回车:
  36. if not defined select goto sc_wrong
  37. echo %select%|findstr "[%str1%]">nul||goto sc_wrong
  38. if %select%==1 (goto sc_info)
  39. if %select%==2 (goto sc_zd)
  40. if %select%==3 (goto sc_sd)
  41. if %select%==4 (goto sc_gl)
  42. if %select%==5 (goto sc_help)
  43. if %select%==6 (goto sc_print)
  44. if %select%==7 (goto sc_update)
  45. :sc_wrong
  46. mshta vbscript:msgbox("只能输入1-7的数字",64,"提示")(window.close)
  47. goto sc_top
  48. :sc_info
  49. cls
  50. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  51. echo                  正在处理信息....
  52. if "%bulid%"=="nt6" goto sc_nt6
  53. :sc_nt5
  54. (echo.
  55. echo.)>>%usertemp%info.txt
  56. ping www.baidu.com -n 1 >nul || echo              互联网状态:       [ 离线 ]>>%usertemp%info.txt && goto sc_ver_nt5
  57. echo              互联网状态:       [ 在线 ]>>%usertemp%info.txt
  58. :sc_ver_nt5
  59. (echo ----------------------------------------------------------
  60. echo.)>>%usertemp%info.txt
  61. for /f "skip=1 tokens=2-4 delims=, " %%a in ('wmic os get caption') do (
  62. if exist %windir%\SysWOW64 echo         系统版本:       %%a %%b %%c  64位>>%usertemp%info.txt & goto sc_ver_nt5_next
  63. echo         系统版本:       %%a %%b %%c  32位>>%usertemp%info.txt
  64. )
  65. :sc_ver_nt5_next
  66. (echo.
  67. echo         计算机名:            %COMPUTERNAME%
  68. echo.)>>%usertemp%info.txt
  69. for /f "tokens=2 delims= " %%a in ('net config workstation^|findstr /c:"工作站域"') do echo         工作组:              %%a>>%usertemp%info.txt & goto sc_info_nt5
  70. :sc_info_nt5
  71. (echo.
  72. echo         当前用户:            %USERNAME%
  73. echo.)>>%usertemp%info.txt
  74. for /f "delims=" %%a in ('date /t') do echo         本机日期:            %%a>>%usertemp%info.txt
  75. echo.>>%usertemp%info.txt
  76. for /f "delims=" %%a in ('time /t') do echo         本机时间:            %%a>>%usertemp%info.txt
  77. echo ---------------------------------------------------------->>%usertemp%info.txt
  78. goto sc_info_more
  79. :sc_nt6
  80. (echo.
  81. echo.)>>%usertemp%info.txt
  82. ping www.baidu.com -n 1 >nul || echo          互联网状态:       [ 离线 ]>>%usertemp%info.txt && goto sc_ver_nt6
  83. echo          互联网状态:       [ 在线 ]>>%usertemp%info.txt
  84. :sc_ver_nt6
  85. (echo --------------------------------------------------
  86. echo.)>>%usertemp%info.txt
  87. for /f "skip=1 tokens=2-5 delims=?, " %%a in ('wmic os get caption') do (
  88. if exist %windir%\SysWOW64 echo    系统版本:      %%a %%b %%c %%d 64位>>%usertemp%info.txt & goto sc_ver_nt6_next
  89. echo    系统版本:       %%a %%b %%c %%d 32位>>%usertemp%info.txt
  90. )
  91. :sc_ver_nt6_next
  92. (echo.
  93. echo    计算机名:            %COMPUTERNAME%
  94. echo.)>>%usertemp%info.txt
  95. for /f "tokens=2 delims= " %%a in ('net config workstation^|findstr /c:"工作站域"') do echo    工作组:              %%a>>%usertemp%info.txt
  96. (echo.
  97. echo    当前用户:            %USERNAME%
  98. echo.)>>%usertemp%info.txt
  99. for /f "delims=" %%a in ('date /t') do echo    本机日期:            %%a>>%usertemp%info.txt
  100. echo.>>%usertemp%info.txt
  101. for /f "delims=" %%a in ('time /t') do echo    本机时间:            %%a>>%usertemp%info.txt
  102. echo -------------------------------------------------->>%usertemp%info.txt
  103. :sc_info_more
  104. 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
  105. 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
  106. :sc_info_next
  107. start /w notepad %temp%\info.txt
  108. del /q %temp%\info.txt>nul 2>nul
  109. goto sc_top
  110. :sc_zd
  111. call :sc_qxfix
  112. cls
  113. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  114. echo                    开始修复......
  115. net user guest /active:yes>nul 2>nul
  116. net user guest "">nul 2>nul
  117. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x1 /f>nul 2>nul
  118. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0x0 /f>nul 2>nul
  119. goto sc_main
  120. :sc_sd
  121. call :sc_qxfix
  122. cls
  123. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  124. echo                    开始修复......
  125. net user guest /active:no>nul 2>nul
  126. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x0 /f>nul 2>nul
  127. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v NtlmMinClientSec /t REG_DWORD /d 0x0 /f>nul 2>nul
  128. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v NtlmMinServerSec /t REG_DWORD /d 0x0 /f>nul 2>nul
  129. goto sc_main
  130. :sc_main
  131. sc config LanmanWorkstation start= auto>nul 2>nul
  132. sc config LanmanServer start= auto>nul 2>nul
  133. sc config Winmgmt start= auto>nul 2>nul
  134. sc config RpcSs start= auto>nul 2>nul
  135. sc config Netman start= auto>nul 2>nul
  136. sc config RasMan start= demand>nul 2>nul
  137. sc config SSDPSRV start= auto>nul 2>nul
  138. sc config BFE start= auto>nul 2>nul
  139. sc config ALG start= demand>nul 2>nul
  140. sc config SharedAccess start= auto>nul 2>nul
  141. net start SharedAccess /y>nul 2>nul
  142. sc config Browser start= auto>nul 2>nul
  143. net start Browser /y>nul 2>nul
  144. sc config Dnscache start= auto>nul 2>nul
  145. net start Dnscache /y>nul 2>nul
  146. sc config Dhcp start= auto>nul 2>nul
  147. net start Dhcp /y>nul 2>nul
  148. sc config lmhosts start= auto>nul 2>nul
  149. net start lmhosts /y>nul 2>nul
  150. sc config Spooler start= auto>nul 2>nul
  151. net start Spooler /y>nul 2>nul
  152. sc config upnphost start= demand>nul 2>nul
  153. net start upnphost /y>nul 2>nul
  154. reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Netlogon" /v Start|findstr "0x4">nul 2>nul && sc config Netlogon start= demand>nul 2>nul
  155. reg add "HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v TransportBindName /t REG_SZ /d \Device\ /f>nul 2>nul
  156. reg delete "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB1 /F>nul 2>nul
  157. reg delete "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB2 /F>nul 2>nul
  158. reg delete "HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v SMBDeviceEnabled /F>nul 2>nul
  159. sc config netbt start= system>nul 2>nul
  160. net start netbt>nul 2>nul
  161. if "%bulid%"=="nt6" goto sc_sernt6
  162. :sc_sernt5
  163. sc config PlugPlay start= auto>nul 2>nul
  164. sc config TapiSrv start= auto>nul 2>nul
  165. sc config Nla start= auto>nul 2>nul
  166. net start Nla /y>nul 2>nul
  167. netsh firewall set opmode mode=disable>nul 2>nul
  168. goto sc_main2_etc
  169. :sc_sernt6
  170. sc config DcomLaunch start= auto>nul 2>nul
  171. sc config RpcEptMapper start= auto>nul 2>nul
  172. sc config SamSs start= auto>nul 2>nul
  173. sc config nsi start= auto>nul 2>nul
  174. sc config SstpSvc start= demand>nul 2>nul
  175. sc config MpsSvc start= auto>nul 2>nul
  176. net start MpsSvc /y>nul 2>nul
  177. sc config NlaSvc start= auto>nul 2>nul
  178. sc config netprofm start= auto>nul 2>nul
  179. sc config fdPHost start= auto>nul 2>nul
  180. sc config FDResPub start= auto>nul 2>nul
  181. sc config HomeGroupListener start= auto>nul 2>nul
  182. sc config WMPNetworkSvc start= auto>nul 2>nul
  183. net start WMPNetworkSvc /y>nul 2>nul
  184. sc config HomeGroupProvider start= auto>nul 2>nul
  185. net start HomeGroupProvider /y>nul 2>nul
  186. netsh advfirewall set allprofiles state off>nul 2>nul
  187. :sc_main2_etc
  188. (echo [Unicode]
  189. echo Unicode=yes
  190. echo [Version]
  191. echo signature="$CHICAGO[        DISCUZ_CODE_0        ]quot;
  192. echo Revision=1
  193. echo [Privilege Rights]
  194. echo sedenynetworklogonright =
  195. echo senetworklogonright = Everyone,Administrators,Users,Power Users,Backup Operators,guest)>>%usertemp%zcl.inf
  196. secedit /configure /db %usertemp%zcl.sdb /cfg %usertemp%zcl.inf /log %usertemp%zcl.log /quiet
  197. del /q %usertemp%zcl.*>nul 2>nul
  198. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v LmCompatibilityLevel /t REG_DWORD /d 0x1 /f>nul 2>nul
  199. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 0x0 /f>nul 2>nul
  200. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymoussam /t REG_DWORD /d 0x0 /f>nul 2>nul
  201. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v everyoneincludesanonymous /t REG_DWORD /d 0x1 /f>nul 2>nul
  202. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v NoLmHash /t REG_DWORD /d 0x0 /f>nul 2>nul
  203. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 0x1 /f>nul 2>nul
  204. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v AutoShareWks /t REG_DWORD /d 0x1 /f>nul 2>nul
  205. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v restrictnullsessaccess /t REG_DWORD /d 0x0 /f>nul 2>nul
  206. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v MaintainServerList /t REG_SZ /d Auto /f>nul 2>nul
  207. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v IsDomainMaster /t REG_SZ /d FALSE /f>nul 2>nul
  208. 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
  209. 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
  210. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" /f>nul 2>nul
  211. net use * /del /y>nul 2>nul
  212. net config server /hidden:no>nul 2>nul
  213. net share ipc[        DISCUZ_CODE_0        ]gt;nul 2>nul
  214. goto sc_tip
  215. :sc_gl
  216. cls
  217. reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest|findstr "0x1">nul 2>nul||goto classic
  218. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x0 /f>nul 2>nul
  219. set jlb=y
  220. :classic
  221. echo.&echo.&echo.&echo.
  222. echo         功能:管理共享,修改共享文件夹权限
  223. echo   ----------------------------------------------
  224. echo.&echo.&echo.&echo.&echo.
  225. echo                    【使用说明】
  226. echo.&echo.
  227. echo        点左侧“共享”可查看本机所有共享;
  228. echo.
  229. echo        右键点左侧“共享”可“新建共享”;
  230. echo.
  231. echo        右键点右侧共享可“停止共享”(能多选);
  232. echo.
  233. echo        右键点右侧共享选“属性”可修改权限;
  234. echo.&echo.&echo.&echo.&echo.&echo.&echo.
  235. fsmgmt.msc
  236. if "%jlb%"=="y" reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x1 /f>nul 2>nul
  237. cls
  238. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  239. echo                     设置完成!
  240. echo.&echo.&echo.
  241. echo            按键盘任意键返回,或直接关闭!
  242. pause>nul 2>nul
  243. goto sc_top
  244. :sc_tip
  245. mshta vbscript:msgbox("修复完成,请重启计算机",64,"提示")(window.close)
  246. goto sc_exit
  247. :sc_help
  248. cls
  249. start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24285252"
  250. goto sc_top
  251. :sc_print
  252. cls
  253. start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24187152"
  254. goto sc_top
  255. :sc_update
  256. cls
  257. start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24178142"
  258. goto sc_top
  259. goto :eof
  260. :sc_qxfix
  261. cls
  262. echo.&echo.&echo.
  263. echo                    【使用说明】
  264. echo    --------------------------------------------
  265. echo.
  266. echo       鼠标复制共享文件夹地址栏路径粘贴到下方
  267. echo.
  268. echo         如果只共享打印机,就按下回车键跳过
  269. echo.&echo.&echo.&echo.&echo.&echo.&echo.
  270. echo 粘贴路径,按回车:
  271. echo.&echo.
  272. set /p lj=
  273. for %%a in ("%lj%") do set name=%%~na
  274. net share "%name%"="%lj%">nul 2>nul
  275. if "%bulid%"=="nt5" cacls "%lj%" /t /e /p everyone:f >nul 2>nul && goto :eof
  276. icacls "%lj%" /grant everyone:(oi)(ci)f>nul 2>nul
  277. goto :eof
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|编程站点 ( 冀ICP备2023028127号-2 )|友链申请|

GMT+8, 2025-7-1 22:19 , Processed in 0.084379 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表