If I have a cscript that outputs lines to the screen, how do I avoid the "line feed" after each print?
Example:
for a = 1 to 10
WScript.Print "."
REM (do something)
next
The expected output should be:
..........
Not:
.
.
.
.
.
.
.
.
.
.
In the past I've used to print the "up arrow character" ASCII code. Can this be done in cscript?
ANSWER
Print on the same line, without the extra CR/LF
for a=1 to 15
wscript.stdout.write a
wscript.stdout.write chr(13)
wscript.sleep 200
next
Use WScript.StdOut.Write()
instead of WScript.Print()
.
WScript.Print()
prints a line, and you cannot change that. If you want to have more than one thing on that line, build a string and print that.
Dim s: s = ""
for a = 1 to 10
s = s & "."
REM (do something)
next
print s
Just to put that straight, cscript.exe
is just the command line interface for the Windows Script Host, and VBScript is the language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With