Package: reading in a line from a file with a colon and exclamation

I am trying to read a line from a file containing a colon and an exclamation mark. When I repeat this line, it only shows AFTER the colon. I need to leave the extended version turned on for more advanced code, which I will do in the do loop. But now I just want to track correctly. Any help would be appreciated!

The file will say something like:

! 12345 APX: 6.32

The code I tried was:

setlocal EnableDelayedExpansion
cd C:\Users\jwagh\Desktop\
for /f "usebackq delims=" %%a in (test.txt) DO (
setlocal DisableDelayedExpansion
 echo %%a
 set line=%%a
 set example=%line:~0,-1%
 echo %example%
)
0
source share
2 answers

, delayedexpansion , delims to ! %%a , ! (, , ! - )

for /f "usebackq delims=!" %%a in (%FamilyFile%) DO echo ^^!%%a
+1

- %%a , . , - :

setlocal DisableDelayedExpansion
for /F "usebackq delims=" %%a in (%File%) do (
    set "Item=%%a"
    setlocal EnableDelayedExpansion
    echo(!Item:,-1!
    endlocal
)

setlocal/endlocal , endlocal . , endlocal , setlocal .


- ( 3 ):
, %File% / , - usebackq.
, :

set "File=D:\Data\file.ext"  & rem // (particularly note the position of the opening quote)

, , .

+1

Source: https://habr.com/ru/post/1665260/


All Articles