Reputation: 103
How can i echo a variable in Windows Command Prompt without the double quotes? I want to use a One-Liner in terminal and no batch script. something like :
set myvar="somevalue"
and now i want to
echo %myvar%
and get
somevalue instead of "somevalue". Is this possible at all?
Upvotes: 0
Views: 2882
Reputation: 80138
echo %myvar:"=%
echo %myvar:~1,-1%
The first way substitutes all occurrences of the string following the :
with the string following the =
The second way selects the substring from "character 1" (batch counts the first character as "character 0") to the first-before-the-end.
see set /?
from the prompt for documentation. The examples use path
but can be applied to any ordinary environment variable.
Upvotes: 2