[英]Setting Variable with VBS to output in Batch
I have a VBSript that outputs a string. 我有一个VBSript输出一个字符串。 Could I set that string as a environment variable?. 我可以将该字符串设置为环境变量吗?
Example: Say my script creates the string: abcstring . 示例:说我的脚本创建了字符串:abcstring。 Well I want to add string output as the variable: StringVar 好吧,我想将字符串输出添加为变量:StringVar
So if I enter %StringVar% in a batch command it will output: abcstring 因此,如果我在批处理命令中输入%StringVar%,它将输出:abcstring
Is this possible? 这可能吗?
If you create it as Volatile
, it will be available after your VBScript terminates (actually, until the user logs off). 如果将其创建为Volatile
,则在您的VBScript终止后(实际上,直到用户注销),它将可用。
With CreateObject("WScript.Shell")
.Environment("VOLATILE")("StringVar") = "This is a string"
End With
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.