Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello all i have a problem...

in my code i echo into a vbscript file but inside the echo i save output... how can i fix it so it echos the whole thing?

echo If intAnswer = vbYes Then   >>C:\users\%username%\appdata\roaming\box.bat.vbs  
echo Set oShell = WScript.CreateObject("WSCript.shell") >>C:\users\%username%\appdata\roaming\box.bat.vbs
echo oShell.run "cmd echo dont delete>C:\users\%username%\appdata\roaming\box.yes.syst" >>C:\users\%username%\appdata\roaming\box.bat.vbs



You see on the line
echo oShell.run "cmd echo dont delete>C:\users\%username%\appdata\roaming\box.yes.syst" >>C:\users\%username%\appdata\roaming\box.bat.vbs

it echos the dont delete into the file C:\users...\box.yes.vbs and it does not echo the whole thing. is there a way to put the whole thing in? by the way i only have a laptop so i do not have access to the num key shortcuts... unless i copy it from here. thanks a ton! -LUKAKA
Posted
Comments
Sergey Alexandrovich Kryukov 3-Nov-15 17:50pm    
What are you trying to achieve, exactly?
Echo is nothing but a function expecting a string on input, nothing else.
—SA

1 solution

Quote:
Hello all i have a problem...
The problem is in your head !
That's what append when you use a commend without knowing what it does.
Said otherwise, your program works perfectly, you just don't know what you asked.

Advice/solution:
-Read reference documentation about Echo

more generally, read documentation about any command /function you use, before using it. This will avoid asking stupid question like yours.

There is no correction to a program that works perfectly as you requested. The only problem is that you don't know what you requested.

[Update]
You need to read documentation about escaping chars in echo.
To make things clear, you should have presented your question in another way.
I have this code
CODE
which produce this
WRONG RESULT
And I need
RIGHT RESULT

That should have made clear what is the problem for every one.
 
Share this answer
 
v2
Comments
Member 12111231 4-Nov-15 7:09am    
no because im using > toenter the output to a file
example;

echo hi >C:\users\%username%\say.txt
echo dude >>C:\users\%username%\say.txt

the text doc will read;

hi
dude.

the problem is that inside the echo i have the > command

echo echo hi >C:\users\%username%\say.txt >C:\users\lucas\yes.bat

i want the document yes.bat to read;

echo hi >C:\users\%username%\say.txt

the problem is the > in what i want to say is confusing it
Patrice T 4-Nov-15 22:44pm    
See update

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900