The things above are very practical, take them
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Originally posted by fornever at 2006-9-9 04:45:
It is not possible to use set name=| through my experiment.
But it is possible after inputting with set /p name=input:, as shown in the figure:
Then you can use the if statement to judge each character one by one, which I have indeed experimented with...
@echo off
set "str=^|"
echo %str%
pause
@echo off
:start
setlocal
cls
set /p var=Please enter characters:
call :filter "%var%"
endlocal
goto start
:filter
setlocal
set "str=%~1★"
set "str=%str:|=%"
set "str=%str:&=%"
set "str=%str:"=%"
echo The filtered characters are: %str:~0,-1%
pause
endlocal
goto :eof
Originally posted by namejm at 2006-9-10 23:03:
Although it works when entered in the CMD command line, it still causes errors when used in batch processing. I'm confused.
@echo off
:start
setlocal
cls
set /p var=Please enter characters:
set "var=%var:"=%"
call :filter "%var%"
endlocal
goto start
:filter
setlocal
set "str=%~1★"
set "str=%str:|=%"
set "str=%str:&=%"
set "str=%str:"=%"
echo The filtered characters are: %str:~0,-1%
pause
endlocal
goto :eof