I wanted to change the name of the file keeping the extension. The condition was if timestamping failed may be because of unavailability of TSAs, then I wanted to mark the file as 'unsigned'
The code for signed was found here
Scenario is:
batch file : sign.bat
arg2 : file1.exe
expected output
if timestamping fails then need to mark the 'file1.exe' as 'file1_unsigned.exe'
After all the searches what I did was,
echo Timestamping failed , marking the file as unsigned.
set file_name=%2
set unsigned_file_name=%file_name:.exe=_unsigned.exe%
ren %file_name% %newfilename%
This kept the file extension by adding a string to original file .
Is there a better way to do this ? may be using pattern matching ?