Author Options:

Is there a way to hold the command line ? Answered

Dears, using Wscript is there a way to perform a Wscript.Echo command and do not skip to the next line? My idea is to perform a display, hold the command line and perform another display over the previous one (in the same line) giving the idea of a blinking message. I tried using the CLS command in a loop but this command is executed just once at the end of the loop. Any response will be greatly appreciated. Regards, Alberto Alencar / Brazil - South America region.



9 years ago


Dear fwjs28, please have a look at the reply I gave for the other member, where you can see the script I tried. I also created a version with the "pause" recommend by you but I had the same result (the command screen paused just after the loop end).

hmm, at first i thought you meant batch scripts/commands..But now i see you are talking abouut another language. So my suggestion will pretty much not do anything, tell me what language it is and i might be able to do some searching

Dear NobodyInParticular, here is the script I tried. If you run it you will see that the command screen is cleared only after the end of the loop, without giving the blinking effect I thought.

'Loop to display 10 times a warning message with the blinking effect

Set WshShell = WScript.CreateObject("WScript.Shell")

ind_loop = 1 'initialize the loop index
Do Until ind_loop > 10
intResult = ind_loop Mod 2 'get the Reminder of the ind_loop divided by 2
If intResult = 0 Then 'when the Reminder is even
Wscript.Echo "Attention => BE ALERT" 'display warning-1
Wscript.Sleep 10 'wait for a while
WshShell.SendKeys "CLS + {ENTER}" 'clear the command screen
Else 'when the Reminder is odd
Wscript.Echo " BE ALERT" 'display warning-2
Wscript.Sleep 10 'wait for a while
WshShell.SendKeys "CLS + {ENTER}" 'clear the command screen
End If
ind_loop = ind_loop + 1 'increment the loop index