I want to handle the string such as project_Name_-_sofeware_Name.txt
into project_Name.txt
, so I wrote a script like following to run:
set temp1=%~n1
echo %temp1:-*=%
But the output of the bat still been project_Name_-_sofeware_Name.txt
.
I have also written another bat file to get the folder name:
:GetFolderName
set temp2=%temp1%
set temp1=%temp2:*\=%
If Not %temp1%==%temp2% Goto GetFolderName
And the output string is in line with expectations by far.
It also is weird. In my opinion, it should be FolderName after running temp1=%temp2:*\=%
.