Why is it, that every time I try to use a variable with a ":" it just doesn't use it as all documentation tells me it would. I am quite frustrated at this point. Please help me out guys!
What I want to do is to manipulate a path in different ways (replacing, extracting substring):
- 1: set /p B=%B :OLD=NEW %
- 2: set /p B=%~dp0 :OLD=NEW
- 3: set /p B=%~dp0 :OLD=NEW%
- 4: filepath[!geil!]=%filepath[!geil!] :%parent%= %
- 5: filepath[!geil!]=%filepath[!geil!] :!parent!= %
- 6: set filepath[!geil!]=%%~dpi :22
- 7: set filepath[!geil!]=%%~dpi :22%
- I also tried further variations, that didn't work either
These Parts don't work. Are there always syntax mistakes? I always end up with literal outputs. Running on Windows 10 Pro
1.
set /p B=%~dp0
rem (C:\Folder1\Folder2\FolderOLD\)
set /p B=%B:OLD=NEW%
rem (C:\Folder1\Folder2\FolderNEW\)
pause
2.
set /p B=%~dp0:OLD=NEW
echo %B%
3.
set /p B=%~dp0:OLD=NEW%
echo %B%
4.
setlocal EnableDelayedExpansion
set parent=%~dp0
set /a geil=0
pause
for /r %%i in (*) do (set filepath[!geil!]=%%~dpi & set filepath[!geil!]=%filepath[!geil!]:%parent%=% & set /a geil+=1)
5.
setlocal EnableDelayedExpansion
set parent=%~dp0
set /a geil=0
pause
for /r %%i in (*) do (set filepath[!geil!]=%%~dpi & set filepath[!geil!]=%filepath[!geil!]:!parent!=% & set /a geil+=1)
6.
setlocal EnableDelayedExpansion
set parent=%~dp0
set /a geil=0
pause
for /r %%i in (*) do (set filepath[!geil!]=%%~dpi:22 & set /a geil+=1)
7.
setlocal EnableDelayedExpansion
set parent=%~dp0
set /a geil=0
pause
for /r %%i in (*) do (set filepath[!geil!]=%%~dpi:22% & set /a geil+=1)