任何人都可以帮助解释批处理文件中使用的VB代码 [英] Could anyone please help in explaining the VB code used in batch file

查看:53
本文介绍了任何人都可以帮助解释批处理文件中使用的VB代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="vb"><pre>
#I am using below code in bat file, but not able to understand the logic in below code since has never worked on vb. Please help me on understanding the below lines of code

:YesNoBox
REM returns 6 = Yes, 7 = No. Type=4 = Yes/No
set YesNo=
set MsgType=4
set heading=%~2
set message=%~1
echo wscript.echo msgbox(WScript.Arguments(0),%MsgType%,WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set YesNo=%%a
exit /b

:MessageBox
set heading=%~2
set message=%~1
echo msgbox WScript.Arguments(0),0,WScript.Arguments(1) >"%temp%\input.vbs"
cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"
exit /b





我尝试了什么:



通过google上的这么多链接消失了但是找不到明确的答案

Red关于wscript和cscript,但与变量混淆如



主要与



What I have tried:

Gone through so many links on google, But not able to find the clear answers
Red about wscript and cscript but confused with variable's like

mostly confused with

REM returns 6 = Yes, 7 = No. Type=4 = Yes/No
set YesNo=
set MsgType=4
set heading=%~2
set message=%~1
echo wscript.echo msgbox(WScript.Arguments(0),%MsgType%,WScript.Arguments(1)) >"%temp%\input.vbs



< br $>






and

:MessageBox
set heading=%~2
set message=%~1
echo msgbox WScript.Arguments(0),0,WScript.Arguments(1) >"%temp%\input.vbs"
cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"





我需要理解上面代码中提到的每一行



I need to understand each line mentioned in above code

推荐答案

那不是VB。

它是批处理文件中使用的DOS / CMD命令。

SET以免你操纵环境变量:批处理文件 - SET命令 [ ^ ]

REM是评论。

ECHO显示文本到th e用户:所有Windows 2000 SP 4命令的帮助 [ ^ ]

CSCRIPT运行脚本文件:cscript | Microsoft Docs [ ^ ] - 在这种情况下,它从 TEMP 文件夹中运行一个名为 INPUT.VBS 的VBS文件,并传递两个环境变量,这些变量是在执行原始批处理文件时提供的,但是除去它们周围的任何引号。
That isn't VB.
It's DOS / CMD commands as used inside a batch file.
SET lest you manipulate Environment Variables: Batch files - The SET command[^]
REM is a comment.
ECHO displays text to the user: Help for all Windows 2000 SP 4 commands[^]
CSCRIPT runs a script file: cscript | Microsoft Docs[^] - in this case it runs a VBS file called INPUT.VBS from the TEMP folder, and passes it two Environment Variables that were supplied when teh original batch file was executed, but with any quotes around them removed.


这篇关于任何人都可以帮助解释批处理文件中使用的VB代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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