Here are a few issue's you're having with your command. Firstly, it looks like you're attempting to rename a file with only -s
. The problem is that Ren "sfml-*-*.lib" ""
cannot assume the wildcard from the file path. Meaning that the REN
does not know what to put for the *
in "sfml-*.lib"
.
To get around this, you will need to address what the *
is. To do this, a FOR
statement can be used. The first thing the FOR statement will need is the filenames. Using the command For /f %%A In ('dir /b *.lib') Do (Echo %%A)
will list all the file names. The issue now is that we only want audio
in sfml-audio-s.lib
.
To grab only certain objects using a FOR
statement, you can add /f "tokens=2" %%A
. This will tell the statement to only grab the second word in phrase. The problem in this scenario is that this only works if sfml-audio-s.lib
was spaced sfml audio s.lib
. By adding delims=-
the statement will ignore all -
in the parse. More info on that here.
From CMD: (Be sure to CD to directory location)
Remove "-s" from *.lib file names
For /f "tokens=2 delims=-" %A In ('dir /b *.lib') Do (Ren "sfml-*-*.lib" "sfml-%A.lib" 2>NUL)
Remove "-s-d" from *.lib file names
For /f "tokens=2 delims=-" %A In ('dir /b *.lib') Do (Ren "sfml-*-*-*.lib" "sfml-%A.lib" 2>NUL)
From BATCH: (Add CD C:\folder location
to the script)
Remove "-s" from *.lib file names
For /f "tokens=2 delims=-" %%A In ('dir /b *.lib') Do (Ren "sfml-*-*.lib" "sfml-%%A.lib" 2>NUL)
Remove "-s-d" from *.lib file names
For /f "tokens=2 delims=-" %%A In ('dir /b *.lib') Do (Ren "sfml-*-*-*.lib" "sfml-%%A.lib" 2>NUL)