本帖最后由 flashercs 于 2018-11-14 01:59 编辑
- @echo off
- set /p _user=please enter your Domain ID:
- set /p _pw=Please enter your Domain PW:
- cls
- for /f "delims=:" %%a in ('findstr /in "^:setup$" "%~f0") do set line=%%a
- for /f "tokens=1,2* delims=:" %%i in ('more +%line% "%~f0"') do (
- for /f "tokens=1 delims=/" %%s in (%%j) do cmdkey add:%%s /user:%_user% /pass:%_pw%
- call :rightTrim "%%j"
- net use %%i: "%return%" /p:y
- )
- echo;Done!
- exit /b
- :rightTrim
- set "str=%~1"
- set /a pos=-1
- set return=
- if not defined str exit /b
- if "%str: =%"=="" exit /b
- :loop
- call set "char=%%str:~%pos%,1%%"
- if "%char%"==" " (
- set /a pos-=1
- goto loop
- )
- if %pos% equ -1 (
- set "return=%str%"
- ) else (
- set /a pos+=1
- call set "return=%%str:~0,%pos%%%"
- )
- exit /b
- :setup
- N:\\10.21.119.168\AllDept
- O:\\scnfsvr01\AllDept
- P:\\scnfsvr01\Shared
- S:\\10.21.119.168\Shared
- Z:\\scnfsvr01\Air\Huawei CS
复制代码
|