China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 06:48
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Error when writing two " symbols in VBS? View 800 Replies 5
Original Poster Posted 2007-04-18 06:37 ·  中国 广东 湛江 电信
初级用户
Credits 28
Posts 10
Joined 2007-02-19 09:47
19-year member
UID 79788
Gender Male
Status Offline
I already put ^ in front of them. It says missing )

dim ws
set ws = wscript.createobject ("wscript.shell")
ireturn = ws.Run("cmd.exe /c echo net start ^| find ^"DHCP Client^">>a.bat", 0, TRUE)

Please help and see how this should be done.

[ Last edited by ngela on 2007-4-17 at 05:38 PM ]
Floor 2 Posted 2007-04-18 06:47 ·  中国 四川 成都 电信
初级用户
Credits 42
Posts 22
Joined 2005-10-16 12:31
20-year member
UID 43580
Status Offline
In VBS, ^ means exponentiation. What are you using exponentiation for? VBS concatenation seems to use & instead!
Floor 3 Posted 2007-04-18 07:02 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
In VBS, for double quotes you need to use & """" &

ireturn = ws.Run("cmd.exe /c echo net start | find " & """" & "DHCP Client" & """" & ">>a.bat", 0, TRUE)
Floor 4 Posted 2007-04-18 07:09 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Floor 5 Posted 2007-04-18 12:25 ·  中国 广东 湛江 电信
初级用户
Credits 28
Posts 10
Joined 2007-02-19 09:47
19-year member
UID 79788
Gender Male
Status Offline
Adding ^ before the | in reply #3 works.

The one in reply #4 says the system cannot find the file specified.

Thanks, everyone.
Floor 6 Posted 2007-04-19 08:38 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Forum Jump: