doscode wrote:But when I replace it, I have %~$ in !$!
Code: Select all
@echo off &setlocal enableDelayedExpansion
for %%? in ( "C:" ) do for %%$ in ("filename.txt") do echo.%%$=%%~$PATH:?_
pause
exit
Code: Select all
"filename.txt"=C:\_
Druk op een toets om door te gaan. . .
Code: Select all
for /?
...
% ~ $ PATH: I - searches the directories in the PATH environment variable and expands
% I to the fully qualified name of the first
file found. If the name of the environment variable
is not specified or if the file is not found,
then this modifier expands to the empty
string.
...
pause
foxidrive wrote:No. Use a, b or c
Using ? is ill advised. There is no advantage to using ? only drawbacks.
http://www.dostips.com/forum/viewtopic.php?p=14254#p14254aGerman wrote:Alpha characters have also side effects. For that reason it's really nothing but a question of the style one would prefer.Code: Select all
@echo off &setlocal
del "dummy.txt" 2>nul
for %%a in ("dummy.txt") do echo %%~aa
for %%A in ("dummy.txt") do echo %%~Aa
for %%A in ("dummy.txt") do echo %%~AA
>>"dummy.txt" type nul
for %%a in ("dummy.txt") do echo %%~aa
for %%A in ("dummy.txt") do echo %%~Aa
for %%A in ("dummy.txt") do echo %%~AA
pause
Result:Code: Select all
ECHO ist ausgeschaltet (OFF).
dummy.txta
ECHO ist ausgeschaltet (OFF).
--a------
dummy.txta
--a------
Drücken Sie eine beliebige Taste . . .
All the characters with special meaning for arguments or FOR variables have those effects.
Regards
aGerman
doscode wrote:I have all letters reserved for tokens A-Z.
Maybe I could use more letters [a-zA-Z] but I don't know if is it possible?
Code: Select all
@echo off &setlocal enableDelayedExpansion
for %%a in (
"It's always better to ask someone to test it for you,"
) do for %%A in (
"than testing it yourself."
) do echo.%%~a^
%%~A
pause
exit
Code: Select all
It's always better to ask someone to test it for you,
than testing it yourself.
Druk op een toets om door te gaan. . .