How to include a carriage return character with a multiple line var in a windows batch file? -
hi i'm trying write file have arguments exec (putty) problem line feed trick not working, how can put carriage return after each line avoiding batch interprets enter.
set lf=^ set previousver=36 set base=%fullver:1.2.0 set out=features:uninstall nocfilelookup !lf removeurl:mvn:org.noc/nocfilelookup-feature/%base%.%previousver%-snapshot/xml !lf addurl mvn:org.noc/nocfilelookup-feature/1.2.0.37-snapshot/xml !lf features:install nocfilelookup!lf config:edit nocfilelookup !lf config:propset context testing !lf config:update @echo %out% > deployall start c:\"program files (x86)"\putty\putty.exe -ssh localhost -l karaf -pw karaf -p 8101 -m deployall
the set lf=^
trick needs 2 blank lines following work. also, syntax retrieving batch variable in delayed expansion style use exclamation mark on both sides of variable name. see https://stackoverflow.com/a/28992360/1683264 example of correct implementation of you're trying do.
but really, you're making more work yourself. why must lines combined single variable included line breaks? batch language isn't terribly welcoming multi-line variable values way javascript , other languages are. if you're doing echoing several lines text file, use several echo
statements.
>deployall ( echo features:uninstall nocfilelookup echo removeurl:mvn:org..noc/nocfilelookup-feature/%base%.%previousver%-snapshot/xml echo addurl mvn:org.noc/nocfilelookup-feature/1.2.0.37-snapshot/xml echo features:install nocfilelookup echo config:edit nocfilelookup echo config:propset context testing echo config:update )
now isn't more readable?
Comments
Post a Comment