Computing.Net > Forums > Programming > Send line to vbs file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Send line to vbs file

Reply to Message Icon

Name: Nath5
Date: November 24, 2007 at 20:26:25 Pacific
OS: XP
CPU/Ram: AMD Turion 2 Gig Ram
Product: Hp
Comment:

I want to send the line
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

to a vbs file so i tried the following line of code


echo CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False>invis.vbs

however that doesn't work, seems to not like all the symbols that are in it. Returns the following error.


C:\Documents and Settings\Nathan\Desktop>echo CreateObject("Wscript.Shell").Run
"""" & WScript.Arguments(0) & """", 0, False 1>invis.vbs
CreateObject("Wscript.Shell").Run """"
'WScript.Arguments' is not recognized as an internal or external command,
operable program or batch file.
'""""' is not recognized as an internal or external command,
operable program or batch file.



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: November 24, 2007 at 20:31:58 Pacific
Reply:

& is a special character. Change it to ^&.


0

Response Number 2
Name: Nath5
Date: November 24, 2007 at 20:45:52 Pacific
Reply:

Tried that and now i get the following error


C:\Documents and Settings\Nathan\Desktop>echo CreateObject("Wscript.Shell").Run
"""" & WScript.Arguments(0) & """", 0, False 1>invis.vbs
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0)
'""""' is not recognized as an internal or external command,
operable program or batch file.


0

Response Number 3
Name: Razor2.3
Date: November 24, 2007 at 21:53:52 Pacific
Reply:

According to my copy/pasting of what you entered, you've broken up the line into two parts. That won't work with only one ECHO, nor would the resulting lines work in VBScript.


0

Response Number 4
Name: Mechanix2Go
Date: November 25, 2007 at 01:32:14 Pacific
Reply:

If it's one line you need to 'escape' the chars which have 'special meaning'. In this case, the &. So use this:

echo CreateObject("Wscript.Shell").Run """
" ^& WScript.Arguments(0) ^& """", 0, False>invis.vbs

===========================
that's ONE liine



=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Dictionary development Q for Justin Weber



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Send line to vbs file

Send line to bat file www.computing.net/answers/programming/send-line-to-bat-file/15979.html

batch file coverting to VBS file www.computing.net/answers/programming/batch-file-coverting-to-vbs-file/15717.html

Script to remove lines from a file www.computing.net/answers/programming/script-to-remove-lines-from-a-file/7090.html