使用windows连接samba服务时,输入用户名密码之后,之后再登录发现不需要输入用户名密码了.
如果想要重新登录可以运行以下脚本.
运行前请将192.168.1.202替换为真实的ip地址.
@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"复制代码