In my program i made it so that it shows 20% or 2% but the percent signs don't show. Any way you to display the percentage symbol?
(This is for minimal character limit don't bother looking down here)
One other place where a percent character is used is as the modulus operator in the SET /A command, in a batch file this should always be passed as a pair of double %%'s. You might expect that to create the variable %1%, but in a batch file it will Fail.
In batch files, the percent sign may be "escaped" by using a double percent sign ( %% ). If part of a command line though you still need a ^ if you are trying to escape a variable, placing the ^ inside the variable name will stop it expanding.
Batch Script - ECHO 1 ECHO. This batch command displays messages, or turns command echoing on or off. 2 Syntax. 3 Example. The following example shows the different variants of the dir command. 4 Output. The following output will be displayed in the command prompt. More ...
To answer this we need to consider all the things in the batch language which use the % symbol: Firstly command line parameters %0 %1 %2 %3 ... Next the FOR command, while most people will sensibly choose parameter letters like %A or %F or %Z, it is perfectly possible to choose numbers %1 %2 %3 ...
Doubling the percent sign will print one percent sign:
echo %%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With