Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert backslashes to forward in batch files [duplicate]

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.

like image 215
remo Avatar asked May 31 '11 15:05

remo


1 Answers

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.

like image 163
Andriy M Avatar answered Sep 27 '22 18:09

Andriy M