When I try
@echo off set PTag=^ echo %PTag%
I get nothing.
Now what\'s interesting is that if there\'s an empty line aft
Just use Delayed Expansion when you show the variable value:
@echo off setlocal EnableDelayedExpansion set "PTag=" echo !PTag!