Search code examples
batch-filevariablessubst

'subst' command used with variable


I have following batch:

subst D: /d
subst D: C:\folder\folder2
pause

And it works fine.

So I tried something different:

set p2=folder2
set p1=C:\folder\%p2%

subst D: /d
subst D: %p1%  
pause

Although when run in console they both look exactly the same, the second version results in error:

subst is not found as internal or external command

Any ideas?


Solution

  • Problem solved - in fact has never existed. In genuine file I tried to use path as variable name instead of p1. Kind of bad idea in batch...