标题: [其他] 【已解决】批处理如何通过for命令设置多个变量? [打印本页]
作者: hbb 时间: 2014-6-7 20:56 标题: 【已解决】批处理如何通过for命令设置多个变量?
本帖最后由 hbb 于 2014-6-7 21:35 编辑
请问以下批处理脚本的for命令得出的三个值如何通过set分别赋值给ip port password变量,谢谢!- @echo off
- echo Wsh.Echo InputBox("请输入IP地址:","提示","")>"%temp%\tmp.vbs"
- echo Wsh.Echo InputBox("请输入端口号:","提示","")>>"%temp%\tmp.vbs"
- echo Wsh.Echo InputBox("请输入密码:","提示","")>>"%temp%\tmp.vbs"
- for /f %%a in ('cscript "%temp%\tmp.vbs" //nologo //e:vbscript') do set "ip=%%a" set "port=%%a" set "password=%%a"
- del /q "%temp%\tmp.vbs"
- pause
复制代码
作者: apang 时间: 2014-6-7 21:24
- @echo off
- (
- echo Wsh.Echo "ip="^&InputBox("请输入IP地址:","提示",""^)
- echo Wsh.Echo "port="^&InputBox("请输入端口号:","提示",""^)
- echo Wsh.Echo "password="^&InputBox("请输入密码:","提示",""^)
- )>"%temp%\tmp.vbs"
- for /f "delims=" %%a in ('cscript "%temp%\tmp.vbs" //nologo //e:vbs') do (
- echo,set "%%a"
- )
- del /q "%temp%\tmp.vbs"
- pause
复制代码
作者: hbb 时间: 2014-6-7 21:35
回复 2# apang
非常感谢,问题解决!
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |