To write less-than, greater-than and pipe characters in batch files, prefix it with caret character. To output caret character, double it.
- Less-than sign: ^<
- Greater-than sign: ^>
- Pipe character (vertical bar): ^|
- Caret character (circumflex): ^^
@echo off
echo Program v1.0 ^| Copyright (c) 2013 Vurdalakov ^| http://codeblog.vurdalakov.net
echo Usage: program.exe ^<directory^>
echo.
echo program.exe c:\Users\vurdalakov\github/myproject
echo Error: wrong delimeter ^^
This code prints the following to STDOUT:
Program v1.0 | Copyright (c) 2013 Vurdalakov | http://codeblog.vurdalakov.net
Usage: program.exe <directory>
program.exe c:\Users\vurdalakov\github/myproject
Error: wrong delimeter ^
No comments:
Post a Comment