在没有WScript.echo的情况下将值从VBscript返回到批处理文件 [英] Returning value from VBscript to Batch file without WScript.echo

查看:116
本文介绍了在没有WScript.echo的情况下将值从VBscript返回到批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将变量从VBscript传递到批处理文件以进一步使用.由于此值是密码,出于安全原因,我不希望它被回显!

I am trying to pass variable from VBscript to batch file for further usage. Since this value is a password, I dont want it to be echoed for security reasons!

VBScript代码:

Code of VBScript:

...
'after the above procedure, password has to be passed to batch file 
WScript.echo password

批处理文件的代码:

FOR /F "usebackq tokens=*" %%r in (`CSCRIPT "D:\PasswordCreation.vbs"`) DO SET PASSWORD=%%r
ECHO %PASSWORD%
Pause

这将密码存储在变量PASSWORD中,但是由于WScrip.echo密码,VBscripts弹出了密码.我可以在不回显的情况下传递此密码吗?还有其他命令吗?

This stores the password in variable PASSWORD but the VBscripts pops out the password because of WScrip.echo password. Can i pass this password Without echoing? Is there some other command for that?

推荐答案

您没有看到VBS的输出-FOR/F批处理语句正在吸收该输出.

You are not seeing the output from VBS - the FOR /F batch statement is absorbing that output.

屏幕输出是批处理脚本中ECHO %PASSWORD%的结果.只需删除该行即可.

The screen output is the result of ECHO %PASSWORD% in your batch script. Simply remove that line.

这篇关于在没有WScript.echo的情况下将值从VBscript返回到批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆