I have a script in batch that finds a filename from path. However, I dont't need the entire filename, only the first six characters. I thought that the following script would work, but it seems to not work with filenames.
set PL=%%~nG
set PL=%PL:~0,6%
It returns "~0,6".