Give this one a go:
@echo off
set "appdir=This is testing for substring : Management\s18vx"
echo %appdir%
REM get substring i.e, s18vx
Set "SubStr=%appdir:~43%"
echo %SubStr%
pause
The Spaces before and after = is really not wanted it here. This will create a variable name with a trialing space and a value with a leading space, i.e: set variable = value will therefore become %variable % and value.
Also wrap your variables in double quotes to eliminate additional whitespace, especially after the variable string.
For more help on the set command, open cmd.exe and type set /?
Some side notes:
Echo is on by default, unless this forms part of a script where echo is turned off earlier and you want to turn it on for some reason, you do not need to switch it on.
Also, I suggest if you want an end result only to turn @echo off because echo on is almost like a debug function, it echos each of the commands you run, where echo off will disable this and display the end result only.
ECHO %SubStr %to match the name you've set for the variable, or use the correct syntax toSetthe variable in the first instance, i.e.Set "SubStr=%appdir:~43%", followed byECHO %SubStr%as before. As a side note, I'd probably consider usingSet "SubStr=%appdir:*\=%"instead.Set "appdir=C:\apps\documents\s18vx"if this string is in fact the case as per his example, then that option is 100% better, but I suspect OP might be using an actual path. :)%~nxI.