windows中斷開samba鏈接,從新登陸

使用windows鏈接samba服務時,輸入用戶名密碼以後,以後再登陸發現不須要輸入用戶名密碼了.
若是想要從新登陸能夠運行如下腳本.windows

運行前請將192.168.1.202替換爲真實的ip地址.markdown

@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
@echo off
echo clear last data,please wait......
net use
net use \\192.168.1.202\IPC$ /DELETE
::清除win保存的認證
klist purge
::m刪除win保存的憑據管理器,delete:後面爲你共享的地址
cmdkey /delete:192.168.1.202
echo clear login data finished
@echo off
net stop LanmanWorkstation
net start LanmanWorkstation
start /max "" "\\192.168.1.202"
複製代碼
相關文章
相關標籤/搜索