批量路径以行情 [英] Batch PATH with Quotes

查看:143
本文介绍了批量路径以行情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查是否路径有报价或没有,添加它如果不是有吗?我知道我可以做这样的:

How can check if path has quotes or not, and add it if not have? I know i can make something like:

set /p path="My path "
"%path%"

但我有引号的问题

But i have problems with quotes

C:\My folder --> "%path%" --> "C:\My folder" --> Good

如果用户把带引号的路径

If the user put a path with quotes

"C:\My folder" --> "%path%" --> ""C:\My folder"" --> Wrong

我不能使用双引号,因为外部命令行我叫不工作,并给我的错误。因此,如何我可以添加,只有在未找到路径?谢谢

I can't use double quotes because the external command line i call not work and give me error. So how i can add "" only if not found in path? Thanks

推荐答案

您可以使用它之前删除的报价,请尝试:

You can remove quote before using it, try:

set path=%path:"=%

路径没有引用了。

例如:

@echo off

set path="a b c"

set path=%path:"=%

echo %path%

输出

a b c

这篇关于批量路径以行情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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