VBS Carriage Return Convert

Hello Experts,

The following is a part of script that performs a carriage when executed on a router:

& chr(13)

Can someone please tell me if its possible to convert that into an equivalent command like


Someone came up with the following:

aryCmds = Split(szCommand, "|").

It does work when directly connected to the device but now through a terminal server.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Use Replace.

Replace(Variable, "findCharacter(s)", "ReplaceWithCharacter(s)")

When you need to replace special characters, use the VB equivalents -


(for example)

More information on Replace:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cpatte7372Author Commented:

I found out that the carriage return script is keymap used in SecureCRT for VBS is "\r". Maybe that needs to be converted instead of "& chr(13)"? I need help with that.


cpatte7372Author Commented:

The carriage return is either & vbcrlf or just & vbcr.

Maybe I need to have that somehow represented in the script???
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

cpatte7372Author Commented:

Thanks for responding. I've looked at the example, however, how would I replace

 "|" with vbCr?

cpatte7372Author Commented:
The actual full script is as follows:

# $language = "VBScript"
# $interface = "1.0"
' SendToAll.vbs

Sub Main()
    if Not crt.Session.Connected then
        szSession = crt.Dialog.Prompt("Enter session:", "", "", False)
        if szSession = "" then exit sub
        crt.Session.ConnectInTab("/S " & szSession)
        crt.Session.ConnectInTab("/S " & szSession)
        crt.Session.ConnectInTab("/S " & szSession)
    end if

    ' Find out what should be sent to all tabs
    szCommand = crt.Dialog.Prompt("Enter command to be sent to all tabs:", _
                                  "Send To All Connected Tabs", "ls", False)
    if szCommand = "" then exit sub
    If crt.Dialog.MessageBox(_
        "Are you sure you want to send the following command to " & _
        "__ALL__ tabs?" & vbcrlf & vbcrlf & szCommand, _
        "Send Command To All Tabs - Confirm", _
        vbyesno) <> vbyes then exit sub
    ' Connect to each tab in order from left to right, issue a command, and
    ' then disconnect...
    aryCmds = Split(szCommand, "|")

        For nIndex = 1 to crt.GetTabCount
            Set objCurrentTab = crt.GetTab(nIndex)

            If objCurrentTab.Session.Connected = True then
                For Each strOneCmd In aryCmds
            crt.Sleep 500
                objCurrentTab.Screen.Send strOneCmd & vbcr
                crt.Sleep 1000
            End if
    MsgBox "The following command was sent to all connected tabs:" & vbcrlf & _
        vbcrlf & szCommand

End Sub
And I need  "|" changed to vbCR, I think....
cpatte7372Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.