Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 68,795 of 68,980    |
|    Herbert Kleebauer to Anton Shepelev    |
|    Re: Replacing a character with a percent    |
|    21 May 24 23:25:37    |
      From: klee@unibwm.de              On 21.05.2024 18:58, Anton Shepelev wrote:              > How can one replace `#' with `%' in the value of a variable?       > I have tried:       >       > SET VAR=%VAR:#=%%%       > SET VAR=%VAR:#=^%%       >       > but to no avail.              I think it is a real bad idea to use a % in a variable,       but this should do it:                     setlocal enabledelayedexpansion       set var=a#b##c       set p=%%              echo %var%       set var=%var:#=!p!%       echo %var%              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca