China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-06 20:50
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Two computers are interconnected in a local area network, thank you! View 1,521 Replies 7
Original Poster Posted 2007-11-11 22:58 ·  中国 浙江 杭州 电信
高级用户
★★
Credits 537
Posts 219
Joined 2007-08-04 09:43
19-year member
UID 94620
Gender Male
From 杭州--半山
Status Offline
How to implement the command for two computers to be interconnected in a local area network, and the method to add to Network Neighborhood, that is, to be able to see the other party in Network Neighborhood. Thank you very much!!!

[ Last edited by junchen2 on 2007-11-12 at 12:25 PM ]
Floor 2 Posted 2007-11-12 09:02 ·  中国 陕西 安康 电信
初级用户
★★
Credits 171
Posts 78
Joined 2006-11-22 11:26
19-year member
UID 71373
Gender Male
Status Offline
Red Maple Leaf's

@ ECHO OFF
color 1b
title Enable LAN Sharing
@ ECHO.
@ ECHO. Instructions
@ ECHO --------------------------------------------------------------------
@ ECHO After executing this batch processing, the following settings will be made:
@ ECHO 1. Allow anonymous enumeration of SAM accounts and shares
@ ECHO 2. If the local account has an empty password, allow other machines to access this machine.
@ ECHO 3. Windows Firewall: Allow file and printer sharing.
@ ECHO 4. Sharing method: Local users authenticate as guests.
@ ECHO 5. Guest account: Enable.
@ ECHO.
@ ECHO With this sharing method, other machines can access this machine without entering a username or password. For example, in a home LAN where everyone is trustworthy, use this method.
@ ECHO.
@ ECHO No matter which sharing method is used, sharing is only for internal use. In the case of using a router to access the Internet, the external network cannot access your machine, so there is no need to worry about being invaded if sharing is enabled. You only need to remember that when dialing up alone, do not enable sharing.
@ ECHO --------------------------------------------------------------------
for /l %%i in (1,1,10000) do @echo %%i>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa /v "restrictanonymous" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v "restrictanonymous" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v "limitblankpassworduse" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa /v "limitblankpassworduse" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "445:TCP" /d "445:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22005" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "137:UDP" /d "137:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22001" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "138:UDP" /d "138:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22002" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "139:TCP" /d "139:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22004" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Epoch /v "Epoch" /t REG_DWORD /d 0x000001ED /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Providers /v "LogonTime" /t REG_BINARY /d E8318E4F6495C601 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "445:TCP" /d "445:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22005" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "137:UDP" /d "137:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22001" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "138:UDP" /d "138:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22002" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "139:TCP" /d "139:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22004" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Epoch /v "Epoch" /t REG_DWORD /d 0x000001ED /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v "forceguest" /t REG_DWORD /d 0x00000001 /F>nul

cls
@ ECHO.
@ ECHO --------------------------------------------------------------------
@ ECHO Operation completed.
@ ECHO Note: It will take effect after this machine restarts.
@ ECHO.
@ ECHO --------------------------------------------------------------------
@ ECHO.
@ ECHO Supplementary questions and answers:
@ ECHO If the previous sharing method was "Local users authenticate as themselves" when sharing a folder,
@ ECHO then when switching to authenticating as a guest and then accessing that folder, an error will pop up: Cannot access, you do not have permission to use the network resource. The solution is to cancel the original sharing properties of that folder, and then share it again.
@ ECHO --------------------------------------------------------------------
for /l %%i in (1,1,10000) do @echo %%i>nul

[ Last edited by afeichai on 2007-11-12 at 09:09 AM ]
Floor 3 Posted 2007-11-12 09:04 ·  中国 陕西 安康 电信
初级用户
★★
Credits 171
Posts 78
Joined 2006-11-22 11:26
19-year member
UID 71373
Gender Male
Status Offline
@ECHO OFF
color 1b
title Enable LAN Sharing
@ECHO.
@ECHO. Description
@ECHO --------------------------------------------------------------------
@ECHO After executing this batch script, the following settings will be made:
@ECHO 1. Allow anonymous enumeration of SAM accounts and shares (
@ECHO 2. If the local account has an empty password, allow other machines to access this machine.
@ECHO 3. Windows Firewall: Allow file and printer sharing.
@ECHO 4. Sharing method: Local users authenticate with their own identities.
@ECHO 5. Guest account: Not enabled.
@ECHO.
@ECHO With this sharing method, you must enter the correct username and password to access this machine when visiting.
@ECHO.
@ECHO Regardless of which sharing method is used, sharing is only for internal use. In the case of using a router to access the Internet,
@ECHO the external network cannot access your machine, so there is no need to worry about being hacked if shared. You only need to remember that when dialing up with a single computer,
@ECHO do not turn on sharing.
@ECHO --------------------------------------------------------------------
for /l %%i in (1,1,10000) do @echo %%i>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa /v "restrictanonymous" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v "restrictanonymous" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v "limitblankpassworduse" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa /v "limitblankpassworduse" /t REG_DWORD /d 0x00000000 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "445:TCP" /d "445:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22005" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "137:UDP" /d "137:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22001" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "138:UDP" /d "138:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22002" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "139:TCP" /d "139:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22004" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Epoch /v "Epoch" /t REG_DWORD /d 0x000001ED /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Providers /v "LogonTime" /t REG_BINARY /d E8318E4F6495C601 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "445:TCP" /d "445:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22005" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "137:UDP" /d "137:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22001" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "138:UDP" /d "138:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22002" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "139:TCP" /d "139:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22004" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Epoch /v "Epoch" /t REG_DWORD /d 0x000001ED /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v "forceguest" /t REG_DWORD /d 0x00000000 /F>nul

cls
@ECHO.
@ECHO ------------------------------------------------
@ECHO Operation completed.
@ECHO Note: It will take effect only after the machine is restarted.
@ECHO.
@ECHO -------------------------------------------------------------------
@ECHO.
@ECHO Common Questions:
@ECHO If after modification, accessing this machine still does not prompt for account and password, it is because the account names of other computers are the same as this machine's (for example, both are administrator), and this machine has no password, so it directly enters. You should rename the local account or set a password. Unauthorized users will not be able to randomly access the resources you shared.
@ECHO -------------------------------------------------------------------
for /l %%i in (1,1,10000) do @echo %%i>nul

[ Last edited by afeichai on 2007-11-12 at 09:09 AM ]
Floor 4 Posted 2007-11-12 09:04 ·  中国 陕西 安康 电信
初级用户
★★
Credits 171
Posts 78
Joined 2006-11-22 11:26
19-year member
UID 71373
Gender Male
Status Offline
@ECHO OFF
color 1b
title Close LAN Sharing
@ECHO.
@ECHO. INSTRUCTIONS
@ECHO ----------------------------------------------------------
@ECHO After executing this batch script, the following settings will be made:
@ECHO 1. Disable anonymous enumeration of SAM accounts and shares (originally allowed in default systems).
@ECHO 2. Do not allow other machines to access this machine if the local account has an empty password.
@ECHO 3. Windows Firewall: Do not allow file and printer sharing.
@ECHO 4. Guest account: Disable.
@ECHO.
@ECHO If you do not often need to transfer files within the LAN, you can close the sharing function to improve
@ECHO security. Especially users who dial up to the Internet with a single computer should close the sharing.
@ECHO ----------------------------------------------------------
for /l %%i in (1,1,5000) do @echo %%i>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa /v restrictanonymous /t REG_DWORD /d 0x00000001 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v restrictanonymous /t REG_DWORD /d 0x00000001 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v limitblankpassworduse /t REG_DWORD /d 0x00000001 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa /v limitblankpassworduse /t REG_DWORD /d 0x00000001 /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "445:TCP" /d "445:TCP:LocalSubNet:Disabled:@xpsp2res.dll,-22005" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "137:UDP" /d "138:UDP:LocalSubNet:Disabled:@xpsp2res.dll,-22001" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "138:UDP" /d "138:UDP:LocalSubNet:Disabled:@xpsp2res.dll,-22002" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "139:TCP" /d "139:TCP:LocalSubNet:Disabled:@xpsp2res.dll,-22004" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Epoch /v Epoch /t REG_DWORD /d 0x000001FC /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "445:TCP" /d "445:TCP:LocalSubNet:Disabled:@xpsp2res.dll,-22005" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "137:UDP" /d "137:UDP:LocalSubNet:Disabled:@xpsp2res.dll,-22001" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "138:UDP" /d "138:UDP:LocalSubNet:Disabled:@xpsp2res.dll,-22002" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v "139:TCP" /d "139:TCP:LocalSubNet:Disabled:@xpsp2res.dll,-22004" /F>nul
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Epoch /v Epoch /t REG_DWORD /d 0x000001FC /F>nul
cls
@ECHO.
@ECHO ----------------------------------------------------------
@ECHO Operation completed.
@ECHO No restart is required, the settings have taken effect.
@ECHO ----------------------------------------------------------
for /l %%i in (1,1,10000) do @echo %%i>nul
exit
Floor 5 Posted 2007-11-12 10:41 ·  中国 浙江 杭州 电信
高级用户
★★
Credits 537
Posts 219
Joined 2007-08-04 09:43
19-year member
UID 94620
Gender Male
From 杭州--半山
Status Offline
Thanks, brother. I'll give it a try.
Floor 6 Posted 2007-11-12 11:12 ·  中国 浙江 杭州 电信
高级用户
★★
Credits 537
Posts 219
Joined 2007-08-04 09:43
19-year member
UID 94620
Gender Male
From 杭州--半山
Status Offline
Thanks again to brother afeichai, the modification was successful, thank you!!!
Floor 7 Posted 2007-11-12 11:14 ·  中国 浙江 杭州 电信
高级用户
★★
Credits 537
Posts 219
Joined 2007-08-04 09:43
19-year member
UID 94620
Gender Male
From 杭州--半山
Status Offline
Thanks again, successful!!!
Floor 8 Posted 2007-12-08 13:16 ·  中国 重庆 电信
中级用户
★★
Credits 235
Posts 109
Joined 2006-08-24 00:52
19-year member
UID 61161
Gender Male
Status Offline
Forum Jump: