|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
setlocal set HOSTS=%SystemRoot%\System32\drivers\etc\hosts set MARKER=#TEMPSHARE findstr /v /c:"%MARKER%" "%HOSTS%" > "%TEMP%\hosts.tmp" copy /y "%TEMP%\hosts.tmp" "%HOSTS%" >nul del "%TEMP%\hosts.tmp" ipconfig /flushdns >nul echo 192.168.xxx.xxx tmp %MARKER%>> "%HOSTS%" ipconfig /flushdns >nul cmdkey /delete:tmp >nul 2>&1 cmdkey /add:tmp /user:xxx /pass:xxx net use * /delete /y net stop workstation /y net start workstation explorer "\\tmp\public" timeout 2 cmdkey /delete:tmp >nul 2>&1 endlocal |