In a batch file, the following returns the drive letter and a colon.
set current_Drive=%~d0
echo %current_Drive%
I need to strip the colon from %current_Drive%
so that the variable drive letter itself ( "C" instead of "C:\" ) can be used to create a text file within the batch, such as-
dir/s > "Myfiles on Drive %current_Drive% .txt"
The colon (:) contained in the var %current_Drive%
is not a legal character in filenames and needs to be stripped out.
I have tried modifying examples from: What does %~d0 mean in a Windows batch file?