'What does percent sign with tilde syntax(%~a) mean in command line [closed]
for %a in (*.txt) do ren "%~a" "%~na version 1%~xa"
This command line script can rename files in a directory by adding text ( version 1
) to the end of filenames.
I'm wondering what do %a
, %~a
, %~na
, %~xa
syntax mean? Where can I find an introduction to these online?
Could you give me an online link to documentation?
Solution 1:[1]
Try checking the documentation for the for
command:
https://technet.microsoft.com/en-us/library/bb490909.aspx
%~a
means expand without quotes, %~na
means filename only, %~xa
means file extension only.
So "%~a"
is the full name with quotes always around it, then the target is the existing name with "version 1" inserted between the name and the extension.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Duncan |