简体   繁体   English

如何将带有特殊字符的参数从vbs传递到批处理文件而不用双引号引起来?

[英]How to pass an parameter with special characters from vbs to batch file without enclosing it in double quotes?

I want pass an parameter with special characters from vbs to batch file without enclosing it in double quotes. 我想将带有特殊字符的参数从vbs传递到批处理文件,而不用双引号引起来。
vbs: vbs:

Set Shell = CreateObject("WScript.Shell")
Shell.Run "Test.bat ""0,(5306546...)"""

batch file: 批处理文件:

@echo off
echo %1
pause > NUL

My goals is the output: 我的目标是输出:

0,(5306546...)

And not: 并不是:

"0,(5306546...)"

If the vbs were: 如果vb是:

Set Shell = CreateObject("WScript.Shell")
Shell.Run "Test.bat 0,(5306546...)"

L'output of the batch file would be: 批处理文件的输出为:

0

This question is different because I didn't know the %~1 command before this answer. 这个问题有所不同,因为在此答案之前我不知道%〜1命令。

Why not simply use 为什么不简单使用

echo %~1

in your batch? 在你的批次?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM