Page 1 of 1

need some corrections of processing a batch for "!" for DelayedExpansion

Posted: 02 Oct 2024 22:05
by nnnmmm
if a website has a symbol "!" in it, this batch does not work on that website selection
possible to correct the code?

F9-WEBSITE.TXT has
http://www.dynamoo.com/technical/ebcdic.htm
-
https://www.dnsstuff.com/
http://www.ztw3.com/forum/forum.php
http://truebasic.com/forum
-
ftp://ftp.mcafee.com/pub/antivirus/datfiles/4.x
http://www.google.com/advanced_search?n ... =&ie=UTF-8
https://www.dict.cc/?s=Matrose!
http://www.hot-keyboard.com/
http://www.mscd.edu/~mdl/gerresources/A.htm
----------------------------------------------------------------

Code: Select all

@ECHO OFF
SET P1=C:\firefox.exe
SET K1=M:\F9-WEBSITE.TXT

SET DS1=0
SET DS2=75
REM *********************************************************************
ECHO %K1%
ECHO.
SetLocal EnableExtensions EnableDelayedExpansion

SET CC=0
FOR /F "DELIMS=" %%V IN ('TYPE "%K1%"') DO (
   SET /A CC=!CC!+1

   IF !CC! GEQ 1 IF !CC! LEQ 9 SET DD= !CC!
   IF !CC! GTR 9 SET DD=!CC!

   SET VV=%%V
   SET C1=0
   IF /I "!VV:~0,1!"=="-" (
      SET /A CC=!CC!-1
      SET C1=1
      ECHO.
   )
   IF /I "!VV:~0,10!"=="http://www"  (SET C1=1)&(ECHO !DD! !VV:~11,%DS2%!)
   IF /I "!VV:~0,11!"=="https://www" (SET C1=1)&(ECHO !DD! !VV:~12,%DS2%!)
   IF /I "!VV:~0,9!"=="ftp://ftp"    (SET C1=1)&(ECHO !DD! !VV:~10,%DS2%!)
   IF /I "!C1!"=="0"                            (ECHO !DD! !VV:~7,%DS2%!)

   IF !CC! EQU 40 GOTO :SCREEN_FULL
)
:SCREEN_FULL

REM ----------------------------------
ECHO.
SET    VAR=DUMMY
SET /P "VAR=INPUT: "
IF %VAR%==DUMMY GOTO :END1
ECHO.

SET CC=0
FOR /F "DELIMS=" %%U IN ('TYPE %K1%') DO (
   SET /A CC=!CC!+1
   SET UU=%%U
   IF /I "!UU:~0,1!"=="-" SET /A CC=!CC!-1
   IF /I NOT "!UU:~0,1!"=="-" IF !VAR!==!CC! (
      SetLocal EnableExtensions DisableDelayedExpansion
      %P1% %%U
      EndLocal
      GOTO :END
   )
)

:END1
:END