中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-07 18:09
48,041 topics / 350,128 posts / today 3 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » How can echo output [%windir%]?
Printable Version  819 / 7
Floor1 ceii Posted 2008-03-11 18:55
初级用户 Posts 45 Credits 115
There are the following three statements:

@echo [%windir%]
@echo [%%windir%%]
@echo [%%windir%%]|sort

The result output by the first statement is: [C:\WINDOWS]
The result output by the second statement is: [%windir%]
The result output by the third statement is: [C:\WINDOWS]

I want the third statement to also output: [%windir%]. How should I modify it?
(In my actual use, the piped output is not sort, but a third-party tool tr.exe)
Floor2 lxmxn Posted 2008-03-11 19:01
版主 Posts 4,938 Credits 11,386
Floor3 suntb Posted 2008-03-11 19:02
高级用户 Posts 277 Credits 581
Floor4 pooronce Posted 2008-03-11 19:03
中级用户 Posts 250 Credits 484
Floor5 ceii Posted 2008-03-11 19:23
初级用户 Posts 45 Credits 115
Thanks, everyone.
The output result in reply #2 is also [%C:\WINDOWS%], not what I want.
Although the result in reply #3 is correct, it doesn't go through a pipe.
There are really a lot of methods in reply #4; I'll have to try them slowly.
Floor6 abcd Posted 2008-03-11 23:57
银牌会员 Posts 739 Credits 1,436
Floor7 zcnvnv Posted 2008-03-12 10:31
初级用户 Posts 36 Credits 114
Do you need to make it that complicated?

echo [^%windir^%]

Completely works
Floor8 abcd Posted 2008-03-12 11:03
银牌会员 Posts 739 Credits 1,436
Originally posted by zcnvnv at 2008-3-12 10:31 AM:
Do you need to make it that complicated?

echo

Completely works

What the OP wants is that it must go through sort.

Not simply just to display %windir%
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023