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.
echo 'C:\Program Files\Program' | sed -e 's/\\/\//g'
精彩评论