1--------- Testing CMD echoer --------- 2 3@pwd@>if 1 == 1 echo j1 | (echo j2 ) else echo j3@space@ 4j2@space@ 5 6@pwd@>(echo a 1>&2 | echo a 1>&2 ) 2>&1@space@ 7a@space@ 8a@space@ 9 10@pwd@>echo 1@space@ 111 122 133 144 15 16@pwd@>foobar 17 18@pwd@>echo 19ECHO is on. 20 21@pwd@>foobar parameter@space@ 22 23@pwd@>echo parameter@space@ 24parameter 25 26@pwd@>toto1>NUL@space@ 27 28@pwd@>toto1>NUL@space@ 29 30@pwd@>toto 1>NUL@space@ 31 32@pwd@>toto 1>NUL@space@ 33 34@pwd@>toto1>NUL 2>&1@space@ 35 36@pwd@>toto1>NUL 2>&1@space@ 37 38@pwd@>toto 1>NUL 2>&1@space@ 39 40@pwd@>toto 1>NUL 2>&1@space@ 41 42@pwd@>a & b 43 44@pwd@>a & b 45 46@pwd@>a & b 47 48@pwd@>a & b 49 50@pwd@>a || b 51 52@pwd@>a || b 53 54@pwd@>a || b 55 56@pwd@>a || b 57 58@pwd@>a && b 59 60@pwd@>a && b 61 62@pwd@>a && b 63 64@pwd@>a && b 65 66@pwd@>if 1 == 1 (echo lol ) else (echo boom )@space@ 67lol 68 69@pwd@>if 1 == 1 (echo lol ) else (echo boom )@space@ 70lol 71 72@pwd@>for /L %l in (1 1 5) do (echo %l )@space@ 73 74@pwd@>(echo 1 )@space@ 751 76 77@pwd@>(echo 2 )@space@ 782 79 80@pwd@>(echo 3 )@space@ 813 82 83@pwd@>(echo 4 )@space@ 844 85 86@pwd@>(echo 5 )@space@ 875 88 89@pwd@>for /L %l in (1 1 5) do (echo %l )@space@ 90 91@pwd@>(echo 1 )@space@ 921 93 94@pwd@>(echo 2 )@space@ 952 96 97@pwd@>(echo 3 )@space@ 983 99 100@pwd@>(echo 4 )@space@ 1014 102 103@pwd@>(echo 5 )@space@ 1045 105 106@pwd@>for /L %l in (1 1 5) do ()@space@ 107 108@pwd@>()@space@ 1091 110 111@pwd@>()@space@ 1122 113 114@pwd@>()@space@ 1153 116 117@pwd@>()@space@ 1184 119 120@pwd@>()@space@ 1215 122 123@pwd@>if 1 == 1@space@ 124hi 125 126@pwd@>if 1 == 1 ()@space@ 127heh 128 129@pwd@>if 1 == 0 () else@space@ 130better 131 132@pwd@>if 1 == 0 () else ()@space@ 133better2 134 135@pwd@>(a)@space@ 136 137@pwd@>(a b )@space@ 138--------- Testing Delayed Expansion --------- 139This is ReactOS! (an open-source operating system) 140Hello 141Hello 142Hello 143Hello! "!" 144"Hello^World" 145"HelloWorld" 146first second 147[Hello Developer how are you] 148[1] 149[2] 150[3] 151[4] 152Total = 4 153lol2 154lol4 155lol6 156lol8 157lol10 158OHLALA 159 160@pwd@>setlocal disabledelayedexpansion@space@ 161 162@pwd@>echo @pwd@\@space@ 163@pwd@\ 164 165@pwd@>set test=abc@space@ 166 167@pwd@>set abc=def@space@ 168 169@pwd@>echo@space@@space@ 170ECHO is on. 171 172@pwd@>echo %@space@ 173% 174 175@pwd@>echo %@space@ 176% 177 178@pwd@>echo %%@space@ 179%% 180 181@pwd@>echo abc@space@ 182abc 183 184@pwd@>echo abc@space@ 185abc 186 187@pwd@>echo %test@space@ 188%test 189 190@pwd@>echo %test%@space@ 191%test% 192 193@pwd@>echo %abc%@space@ 194%abc% 195 196@pwd@>echo !test!@space@ 197!test! 198 199@pwd@>echo !!test!!@space@ 200!!test!! 201 202@pwd@>endlocal 203 204@pwd@>setlocal enabledelayedexpansion@space@ 205 206@pwd@>echo !@space@ 207ECHO is on. 208 209@pwd@>echo !!@space@ 210ECHO is on. 211 212@pwd@>echo !!!@space@ 213ECHO is on. 214 215@pwd@>echo !!!!@space@ 216ECHO is on. 217 218@pwd@>echo !a!@space@ 219ECHO is on. 220 221@pwd@>echo !!a!!@space@ 222ECHO is on. 223 224@pwd@>set a=b@space@ 225 226@pwd@>echo !!a!!@space@ 227b 228 229@pwd@>set b=c@space@ 230 231@pwd@>echo !!a!!@space@ 232b 233 234@pwd@>echo@space@@space@ 235ECHO is on. 236 237@pwd@>echo@space@@space@ 238ECHO is on. 239 240@pwd@>echo %test@space@ 241%test 242 243@pwd@>echo %test%@space@ 244%test% 245 246@pwd@>echo %%@space@ 247%% 248 249@pwd@>echo@space@@space@ 250ECHO is on. 251 252@pwd@>echo !!@space@ 253ECHO is on. 254 255@pwd@>echo !!test!!@space@ 256ECHO is on. 257 258@pwd@>echo !!test!!@space@ 259ECHO is on. 260 261@pwd@>echo !^!test^!!@space@ 262test! 263 264@pwd@>echo !test!@space@ 265ECHO is on. 266 267@pwd@>echo !test!!@space@ 268ECHO is on. 269 270@pwd@>echo !!test!@space@ 271ECHO is on. 272 273@pwd@>echo !!test!!@space@ 274ECHO is on. 275 276@pwd@>echo !!!test!!!@space@ 277ECHO is on. 278 279@pwd@>set proj=XYZ@space@ 280 281@pwd@>echo !XYZ_folder!@space@ 282ECHO is on. 283 284@pwd@>echo !!proj!_folder!@space@ 285XYZ_folder 286 287@pwd@>set XYZ_folder=\\server\folder\@space@ 288 289@pwd@>echo !XYZ_folder!@space@ 290\\server\folder\ 291 292@pwd@>echo !!proj!_folder!@space@ 293XYZ_folder 294 295@pwd@>if 1 == 1 ( 296set "pc=T"@space@@space@ 297 echo pc == !pc!@space@@space@ 298 set i=3@space@@space@ 299 set "!pc!!i!=5"@space@@space@ 300 echo other pc == !pc! and !pc!!i! == !!pc!!i!!@space@@space@ 301 echo other pc == !pc! and !pc!!i! == !!pc!!i!!@space@@space@ 302 echo other pc == !pc! and !pc!!i! == !!pc!!i!!@space@@space@ 303 echo other pc == !pc! and !pc!!i! == !!pc!!i!!@space@@space@ 304 set "trol=!pc!!i!"@space@@space@ 305 echo the var was !trol!@space@@space@ 306 set "!pc!N=!i!"@space@@space@ 307 echo updated !pc!N == !!pc!N!@space@@space@ 308 echo updated !pc!N == !!pc!N!@space@@space@ 309 echo updated !pc!N == !!pc!N!@space@@space@ 310 echo updated !pc!N == !!pc!N!@space@@space@ 311 set "trol=!pc!N"@space@@space@ 312 echo updated !pc!N == !trol!@space@ 313)@space@ 314pc == T 315other pc == T and T3 == T3 316other pc == T and T3 == T3 317other pc == T and T3 == T3 318other pc == T and T3 == T3 319the var was T3 320updated TN == TN 321updated TN == TN 322updated TN == TN 323updated TN == TN 324updated TN == TN 325 326@pwd@>echo --------- Parsing FOR, IF and REM commands ---------@space@ 327--------- Parsing FOR, IF and REM commands --------- 328 329@pwd@>fOr / %d iN (*) do eCHo %d@space@ 330 331@pwd@>eCHo script_testsuite@space@ 332script_testsuite 333 334@pwd@>for / %d in (*) do echo %~ed@space@ 335 336@pwd@>echo %~ed@space@ 337%~ed 338 339@pwd@>for / %d in (*) do echo D::@space@ 340 341@pwd@>echo D::@space@ 342D:: 343 344@pwd@>fOr /L %c iN (1 1 5) Do echo@tab@@space@@space@@space@@space@@tab@@tab@%c@space@ 345 346@pwd@>echo@tab@@space@@space@@space@@space@@tab@@tab@1@space@ 347@space@@space@@space@@space@@tab@@tab@1 348 349@pwd@>echo@tab@@space@@space@@space@@space@@tab@@tab@2@space@ 350@space@@space@@space@@space@@tab@@tab@2 351 352@pwd@>echo@tab@@space@@space@@space@@space@@tab@@tab@3@space@ 353@space@@space@@space@@space@@tab@@tab@3 354 355@pwd@>echo@tab@@space@@space@@space@@space@@tab@@tab@4@space@ 356@space@@space@@space@@space@@tab@@tab@4 357 358@pwd@>echo@tab@@space@@space@@space@@space@@tab@@tab@5@space@ 359@space@@space@@space@@space@@tab@@tab@5 360 361@pwd@>iF 457 NEQ 458 (echo@space@@tab@ D: ) eLSe (echo $~d0@space@@tab@ )@space@ 362@tab@ D:@space@ 363 364@pwd@>iF "2147483647" GEQ "2147483648" (Echo Larger ) Else (ecHO sMaLlEr )@space@ 365sMaLlEr 366 367@pwd@>iF eRrOrlevel 0 echo hi!@space@ 368hi 369 370@pwd@>rEM /v@space@@tab@/d@space@ 371 372@pwd@>REm@space@@space@@space@@tab@@tab@ /d@space@ 373 374@pwd@>rEm REM2 /d@space@ 375 376@pwd@>reM@space@@tab@ /d@space@@tab@ >@space@@tab@ NUL@space@ 377 378@pwd@>echo --------- Parsing random commands ---------@space@ 379--------- Parsing random commands --------- 380 381@pwd@>dir 1>NUL & (b)@space@ 382 383@pwd@>setlocal enabledelayedexpansion@space@ 384 385@pwd@>echo @pwd@\@space@ 386@pwd@\ 387 388@pwd@>set SOMEVAR=C:\ReAcToS@space@ 389 390@pwd@>rem C:\ReAcToS |@space@ 391 392@pwd@>Set "_var=first"@space@ 393 394@pwd@>Set "_var=second" & Rem first !_var!@space@ 395 396@pwd@>Set "_var=third" & Echo second !_var!@space@ 397second third 398 399@pwd@>endlocal 400 401@pwd@>echo --------- Parsing line continuations ---------@space@ 402--------- Parsing line continuations --------- 403 404@pwd@>(a & b@space@ 405 c@space@ 406 d)@space@ 407 408@pwd@>( 409a && b@space@ 410 c@space@ 411 d 412)@space@ 413 414@pwd@>(a & b)@space@ 415 416@pwd@>(a & b)@space@ 417 418@pwd@>(a & b@space@ 419 c & d)@space@ 420 421@pwd@>(a & b@space@ 422 c & d)@space@ 423 424@pwd@>(a & b@space@ 425 c@space@ 426 d)@space@ 427 428@pwd@>( 429a && b@space@ 430 c@space@ 431 d 432)@space@ 433 434@pwd@>( 435a || b@space@ 436 c@space@ 437 d 438)@space@ 439 440@pwd@>( 441a@space@ 442 b & c@space@ 443 d 444)@space@ 445 446@pwd@>( 447a@space@ 448 b && c@space@ 449 d 450)@space@ 451 452@pwd@>( 453a@space@ 454 b@space@ 455 c && d 456)@space@ 457 458@pwd@>( 459a@space@ 460 b@space@ 461 c & d 462)@space@ 463 464@pwd@>( 465a@space@ 466 b@space@ 467 c@space@ 468 d 469)@space@ 470 471@pwd@>REMbaz trol^@space@ 472 473@pwd@>if 1 == 1 (echo a ) else (echo b )@space@ 474a 475 476@pwd@>if 1 == 1 (echo a ) else (echo b )@space@ 477a 478 479@pwd@>if 1 == 1 (echo a ) else (echo b )@space@ 480a 481 482@pwd@>if 1 == 1 (echo a ) else (echo b )@space@ 483a 484 485@pwd@>REM if 1==1 (^@space@ 486 487@pwd@>REM echo a@space@ 488 489@pwd@>REM ) ^@space@ 490 491@pwd@>REM else@space@ 492 493@pwd@>REMREM echo b@space@ 494 495@pwd@>REM )@space@ 496 497@pwd@>REM if 1==1 (^@space@ 498 499@pwd@>REM echo a@space@ 500 501@pwd@>REM ) ^@space@ 502 503@pwd@>REMREM (^@space@ 504 505@pwd@>REM echo b@space@ 506 507@pwd@>REM )@space@ 508 509@pwd@>REM if 1==1 (^@space@ 510 511@pwd@>REM echo a@space@ 512 513@pwd@>REM ) ^@space@ 514 515@pwd@>REMREM (@space@ 516 517@pwd@>REM echo b@space@ 518 519@pwd@>REM )@space@ 520 521@pwd@>if 1 == 1 (echo a )@space@ 522a 523 524@pwd@>if 1 == 1 ()@space@ 525a 526 527@pwd@>(foo bar )@space@ 528 529@pwd@>(foo & & bar@space@ 530 baz)@space@ 531 532@pwd@>( 533foo && bar@space@ 534 baz 535)@space@ 536 537@pwd@>REMREM && bar@space@ 538 539@pwd@>REM baz@space@ 540 541@pwd@>REM )@space@ 542 543@pwd@>( 544bar@space@ 545 baz 546)@space@ 547 548@pwd@>(foo & & bar@space@@space@ 549 baz)@space@ 550 551@pwd@>( 552foo@space@ 553 bar 554)@space@ 555 556@pwd@>(foo bar )@space@ 557 558@pwd@>(foo & & bar@space@ 559 baz)@space@ 560 561@pwd@>( 562foo && bar@space@ 563 baz 564)@space@ 565 566@pwd@>REM (@space@ 567 568@pwd@>REM 569 570@pwd@>REM 571 572@pwd@>REMREM && bar@space@ 573 574@pwd@>REM baz@space@ 575 576@pwd@>REM )@space@ 577 578@pwd@>( 579bar@space@ 580 baz 581)@space@ 582 583@pwd@>(foo & & bar@space@@space@ 584 baz)@space@ 585 586@pwd@>( 587foo@space@ 588 bar 589)@space@ 590 591@pwd@>("!pc::=!")@space@ 592 593@pwd@>("!pc::^=^!^")@space@ 594 595@pwd@>("!pc::=!")@space@ 596 597@pwd@>(!")@space@ 598 599@pwd@>REM @ 2>&1 ( ( dir) ) && lol@space@ 600 601@pwd@>echo & & & lol 602ECHO is on. 603 604@pwd@>REM echo & ^@space@ 605 606@pwd@>REMREM &&lol@space@ 607 608@pwd@>trol & & lol 609 610@pwd@>trol& & lol 611 612@pwd@>REM (echo hi)^@space@ 613 614@pwd@>REM &&lol@space@ 615 616@pwd@>remline@space@ 617 618@pwd@>echo trolline@space@ 619trolline 620--------- Finished -------------- 621