+ -
当前位置:首页 → 问答吧 → [CMD echo 求救]

[CMD echo 求救]

时间:2013-11-12

来源:互联网

Example
set string1="a&b"
echo %string1%
Result: a

点先可以echo出到a&b?
Thanks

作者: zone1326   发布时间: 2013-11-12

引用:原帖由 zone1326 於 2013-10-17 10:38 AM 发表
Example
set string1="a&b"
echo %string1%
Result: a

点先可以echo出到a&b?
Thanks
But my os...
C:\>set string1="a&b"
C:\>echo %string1%
"a&b"


Anyway, your answer is:
C:\>set string1=a^^^&b
C:\>echo %string1%
a&b

作者: 111x111=12321   发布时间: 2013-11-13

Thank you.

There is another problem
Example
set string1="a& b"

I want the echo result = a& b, is it possible?
I use %string1:~1,1% to remove the first and last "
But when I echo, I get result a only

I tried to set string1="a^^^& b" also but not successful

作者: zone1326   发布时间: 2013-11-13

引用:原帖由 zone1326 於 2013-10-17 03:52 PM 发表
Thank you.

There is another problem
Example
set string1="a& b"

I want the echo result = a& b, is it possible?
I use %string1:~1,1% to remove the first and last "
But when I echo, I get resu ...
试新野你要简单d, 排除互相影响因素, 况且你自己好乱...

点解多左个space???
你想trim个 " 就只试佢,
唔好沟埋 &, 个 & 系麻烦野, 因为佢本身另有用途.

其实个 " 亦正正系本身有用途.

作者: 111x111=12321   发布时间: 2013-11-13

set string1=a^^^&b

作者: dynix.tw2   发布时间: 2013-11-13

其实系咁
我本身有个text file (a.txt), 入面有两行
hello & good day-morning
-

我要将第二行果个- 转做另一个string
我试用for /f 去check每行第一个char系唔系-, 如果系就转佢做另一个string 之后要output落个新txt file
如果第一个char唔系- 就唔驶转任何野

因为试左如果有space, 佢净系会read到space之前既野, 所以我行for /f 果阵每行头尾都加左"
所以最尾又要trim返走头尾"

自己都写到乱晒

作者: zone1326   发布时间: 2013-11-13

热门下载

更多