What is wrong with my code plz?

Discussion in 'Scripting' started by Pasta88, Dec 10, 2021.

  1. Pasta88

    Pasta88 MDL Expert

    Jun 17, 2009
    1,332
    44
    60
    #1 Pasta88, Dec 10, 2021
    Last edited by a moderator: Dec 11, 2021
    Hi,

    I am trying to create a VBS script that will start my VPN and then check my ip address. This is the code I am using:

    Code:
    @echo
    cd "C:\Program files\Hotspot Shield\Hotspot Shield vpn"
    
    Start vpn.exe -min
    
    timeout 15
    
    set shl=CreateObject("wscript.shell")
    shl.run "www.whatismyip.com"
    
    timeout 15
    
    but I am getting the following error:
    Code:
    ECHO is on.
    
    C:\Users\johns\Desktop>cd "C:\Program files\Hotspot Shield\Hotspot Shield vpn"
    
    C:\Program Files\Hotspot Shield\Hotspot Shield VPN>Start Hotspot Shield.exe -min
    
    C:\Program Files\Hotspot Shield\Hotspot Shield VPN>timeout 15
    
    Waiting for  0 seconds, press a key to continue ...
    
    C:\Program Files\Hotspot Shield\Hotspot Shield VPN>set shl=CreateObject("wscript.shell")
    
    C:\Program Files\Hotspot Shield\Hotspot ShieldVPN>shl.run "www.whatismyip.com"
    'shl.run' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\Program Files\Hotspot Shield\Hotspot Shield VPN>timeout 120
    
    Waiting for 103 seconds, press a key to continue ...
    
    Just wondering what I am doing wrong when it comes to the bolded code plz?

    Thx
     
  2. LiteOS

    LiteOS Windowizer

    Mar 7, 2014
    2,208
    982
    90
    shl is bat file? should rename it to .bat or .cmd
     
  3. Pasta88

    Pasta88 MDL Expert

    Jun 17, 2009
    1,332
    44
    60
    #3 Pasta88, Dec 10, 2021
    Last edited: Dec 10, 2021
    (OP)
    nevermind... i am all set.