转换反斜杠在批处理文件转发 [英] convert backslashes to forward in batch files
本文介绍了转换反斜杠在批处理文件转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么将所有反斜杠在批处理文件的路径转发,因为我需要使用bash执行的最简单的方法。
解决方案
SET字符串= D:\\路径\\为\\文件夹
ECHO%字符串:\\ = /%
基本上,你需要首先将字符串值存储到一个环境变量,然后使用下面的模板:
%变量: STR1 = STR2 %
,以取代所有出现的 STR1
的中的 变量
与 STR2
的
您可以随时通过调用 SET /?
在命令提示符下。
whats the easiest way of converting all backslashes to forward in a path in a batch file, since I need to use bash for execution.
解决方案
SET "string=D:\path\to\folder"
ECHO %string:\=/%
Basically, you need first to store the string value into an environment variable, then use the following template:
%variable:str1=str2%
to replace every occurrence of str1
in variable
with str2
.
You can always remind yourself about this pattern by invoking SET /?
from the command prompt.
这篇关于转换反斜杠在批处理文件转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文