关于批处理的问题?
发布网友
发布时间:2022-04-24 09:14
我来回答
共2个回答
热心网友
时间:2022-06-18 10:56
你的意思不太懂,我帮你写了个代码看看是不是你要的~
:begin
if not exist %temp%\psw.dat (
echo.&echo it's your first try!
set /p username=please set your username:
set /p password=please set your password:
if "%username%"=="" (echo sorry,username can't be empty & goto begin)
if "%password%"=="" (echo sorry,password can't be empty & goto begin)
set /p password2=set password again :
set /p username2=set username username:
if %password%==%password2% echo %password%>%temp%\psw.dat&cls
if %username%==%username2% echo %username%>%temp%\user.dat&cls
)
:lb
set /p b=请输入ADSL账号:
set /p c=请输入ADSL密码:
start "C:\Windows\system32\rasdial 宽带连接" %b% %c%
if "%b%"=="" (cls & echo sorry,username can't be empty & goto lb)
for /f "tokens=1" %%i in (%temp%\psw.dat) do (
if %b%==%%i (
if "%c%"=="" (cls & echo sorry,password can't be empty & goto lb)
for /f "tokens=1" %%i in (%temp%\user.dat) do (
if %c%==%%i (
echo C:\Windows\system32\rasdial 宽带连接 %b% %c% >c:\windows\au2.bat
@echo Set ws = CreateObject("Wscript.Shell") >c:\windows\自动ADSL拨号.vbs
@echo ws.run "cmd /c c:\windows\au2.bat",vbhide >>c:\windows\自动ADSL拨号.vbs
echo [InternetShortcut] >>C:\Docume~1\Admini~1\「开始」菜单\程序\启动\自动ADSL拨号.url
echo URL=c:\windows\自动ADSL拨号.vbs >>C:\Docume~1\Admini~1\「开始」菜单\程序\启动\自动ADSL拨号.url
echo IconIndex=0 >>C:\Docume~1\Admini~1\「开始」菜单\程序\启动\自动ADSL拨号.url
echo IconFile=c:\windows\自动ADSL拨号.vbs >>C:\Docume~1\Admini~1\「开始」菜单\程序\启动\自动ADSL拨号.url
c:
cd \
cd windows
attrib +s +h +a au2.bat
attrib +s +h +a 自动ADSL拨号.vbs
cd C:\Docume~1\Admini~1\「开始」菜单\程序\启动
attrib +s +h +a 自动ADSL拨号.url
exit)else :lb
热心网友
时间:2022-06-18 10:57
你是考试用的还是解决问题用的?