Reputation: 21
Can anyone help me understand what is wrong with following code
SETLOCAL ENABLEDELAYEDEXPANSION
set currentDirectory = %CD%
set "currentDirectory = %currentDirectory:\=/%"
It doesn't seem to be replacing the forward slash with backward slash
Upvotes: 1
Views: 97
Reputation:
When set
ting variables, you need to know that variables include the whitespace before and after the =
You should therefore have no spaces. The below example is also shorter as we do not have to set currentDirectory
twice:
@echo off
set "currentDirectory=%cd:\=/%"
Upvotes: 1