I have the code from the first Postin changed somewhat.
Code: Select all
@echo off
setlocal enableextensions disabledelayedexpansion
set ^"str= hello ^&^"^& world! ^"
echo CALL ^&^& echo(success ^|^| echo(failure
call && echo(success || echo(failure
echo.
echo.
echo (CALL) ^&^& echo(success ^|^| echo(failure
(call) && echo(success || echo(failure
echo.
echo.
echo (CALL;) ^&^& echo(success ^|^| echo(failure
(call;) && echo(success || echo(failure
echo.
echo.
echo CALL set "str1=%%%%str%%%%" ^&^& echo(success ^|^| echo(failure
call set "str1=%%str%%" && echo(success || echo(failure
echo.
echo.
echo call (SET "str1=%%%%str%%%%" ^&^& echo(success ^|^| echo(failure
call (set "str1=%%str%%" && echo(success || echo(failure
echo.
set str
endlocal & goto :eof
Here the output:
Code: Select all
D:\CMDVerz>test66
CALL && echo(success || echo(failure
success
(CALL) && echo(success || echo(failure
failure
(CALL;) && echo(success || echo(failure
success
CALL set "str1=%%str%%" && echo(success || echo(failure
success
call (SET "str1=%%str%%" && echo(success || echo(failure
failure
str= hello &"& world!
D:\CMDVerz>
The first command to the CALL command follows another character (space). The CALL command is executed correctly.
In the second command the CALL command follows no other sign. The CALL command can not be executed correctly.
The third command the CALL command follows another character (semicolon). The CALL command is executed correctly.
The fourth command the CALL command follows a complete command. The CALL command is executed correctly.
The fifth command the
CALL command
follows an open parenthesis. Everything what comes after the opening parenthesis is running as an independent command (
SET command). The
SET command is not correctly carried out (reason: Number of quotes).