eshelmand at gmail
Jul 6, 2009, 10:55 PM
Post #7 of 7
Thanks for the good information. I am excited to get started
Re: Command-line connection to listening client from Vista machine? [now SCRIPTS]
[In reply to]
developing automated access with VNC through routers to various PCs.
Kansas City, MO
On Jul 6, 2009, at 2:00 PM, Philip Herlihy wrote:
> EDIT is pretty old stuff. I just use notepad, or maybe an advanced
> programmer's editor like ConText or Crimson Editor (which can
> highlight keywords, both free). Sometimes I use Vi on Windows for
> the "Regular Expression" support! Just create the text anyhow and
> save with either .cmd (preferred) or .bat extension (see here for
> differences) - then run it.
> The VB family (VB, VBA, VBS) are different. They need a "runtime"
> to provide library functions. In Excel VBA, the runtime is built
> into Excel (VBA scripts don't run in isolation). In full-blown VB,
> you have to provide a runtime as part of the installation package.
> With VBS, you can use Cscript.exe or Wscript.exe to provide the
> necessary environment within the NT command-line environment. See http://support.microsoft.com/kb/232211
> for more, or see http://technet.microsoft.com/en-gb/scriptcenter/default.aspx
> for tons of stuff. Do understand that vanilla NT scripting is
> considered really old hat these days.
> After my signature I'll paste in a recent (crude) example NT
> script. Copy into Notepad and save as PingMonitor.cmd and run it.
> All it does is loop, pinging an IP address (set in a variable), in
> this case the BBC. When it responds, it plays a sound (your path
> may vary, as may your file association for *.wav files), changes the
> colour of the text in the window and sets the window's title to "###
> UP ###". You can leave it running in the background, minimised, and
> if you glance at the taskbar icon it tells you the connection status
> of the remote machine - that's if you don't notice Windows Media
> Player popping up to play the TADA sound! If you need to stop it,
> use Control-C in the command window.
> If you have VNC running on remote machines which get their addresses
> from DHCP, then you have two options. Run a listening client at
> your end, and manage your own incoming port forwarding for port
> 5500. Then the client simply has to right-click their VNC server
> icon and enter your IP or domain address, and it'll connect. To
> speed this up, you can leave a command script on their desktop (etc)
> which runs:
> WinVNC4.exe -connect YOURADDRESS
> I've wrapped mine up in all sorts of VBS which pops up an
> information panel and checks for a running server - this now needs
> work to cope with Vista. If you're trying to initiate a connection
> from a Vista box running VNC as a service you need to add "-service"
> in the line above. Here the user is connecting to you, of course.
> The other option is to use Dynamic DNS. I use DynDNS.com. You
> register for an account, and add a (free) Dynamic DNS hostname. It
> picks up your current IP address, and links that with a third-level
> domain name you invent, choosing from a range of second-level
> domains available. To maintain the connection when the IP address
> changes, you should download, configure and run the updating client
> available on the DynDNS site (under support). Works a treat -
> usually propagates within 5 to 10 minutes after the new address is
> detected by the update client. Then, if port forwarding is
> configured (or unnecessary) at the remote end, and firewalls are
> appropriately set, you can simply give the DynDNS domain name as the
> remote (server) address in the VNC client. DynDNS have paid-for
> services which you might need, depending on your requirements.
> If you're reaching a number of machines through one (reasonably
> sophisticated) router, you can set up "rules" to accept VNC
> connections on other ports (add a double-colon and the port number
> after the address in the client's address box) and have the router
> configured to route it to the preferred machine, translating the
> port to 5900, the standard one for VNC. If your router can't do
> that, then you can configure VNC to respond on a different port, and
> route that port to the particular machine.
> Hope that helps.
> Philip Herlihy
> Here's that example NT script:
> set addr=220.127.116.11
> echo off
> title down
> color 0C
> ping -n 1 -w 10000 %addr% | grep -i "TTL"
> if errorlevel 1 GOTO :loop
> color 0A
> title ### UP ###
> From: Dale Eshelman [mailto:eshelmand [at] gmail]
> Sent: 05 July 2009 17:12
> To: Philip Herlihy
> Subject: Re: Command-line connection to listening client from Vista
> machine? [now SCRIPTS]
> I have wondered how to do this in Windows. I have written DOS batch
> files, UNIX scripts, written COBAL programs, written al lot of Excel
> macros in Visual Basic for Applications (VBA). Have heard IT people
> talk about writing SCRPTS but did not know what that meant.
> I have gone to start-run and typed EDIT. Entered DOS commands and
> saved the file with and extension BAT. Did not know there is a
> command line in Windows and I guess that is cscript.exe. But not
> sure how to open a blank window to enter script. Or do you just open
> a text editor and start typing, save with an extension CMD, type the
> name of the script you just saved and it runs? Not sure.
> Definitely need to find out more about it so I can work on it. Gee I
> can not believe I have used windows all this time and not learned
> about this.
> Any guidance would be appreciated or even samples. Very interested
> in the VNC thing as we have a number of users with DHCP that we need
> to come up with a fixed IP by registering to track (although not
> sure how this works) and set up a script to have them run so we do
> not have to spend a long time walking them through finding the IP
> and starting VNC.
> On Jul 5, 2009, at 10:31 AM, Philip Herlihy wrote:
>> Sorry it's taken so long to respond - inundated with email lately!
>> From the way you frame your question it sounds as if scripting
>> would be a
>> new avenue for you. I'll give a brief summary here (for fear of
>> exasperating experienced scripters). If you want more information,
>> me direct.
>> "Scripting" simply means storing a series of commands in a file and
>> running the file in one go. It's a close cousin to "programming" -
>> programs are normally converted into a binary program by a
>> "compiler", while
>> scripts are usually "interpreted" line by line by some other running
>> There are several "interpreters" available for Windows NT and its
>> descendents. If you click Start, Run, then type CMD and click OK
>> you'll get
>> the familiar DOS-like command interpreter. With a few adjustments,
>> you type in there can be stored in a script and run. If you put the
>> following lines in a text file:
>> .. and save that as mytest.cmd (not mytest.txt) you can double-
>> click it and
>> you'll see the black window appear with the output of the DIR
>> command (which
>> lists files) and a line inviting you to press any key to continue
>> (at which
>> point the screen disappears, which is why many of my scripts end with
>> PAUSE!). If you Google for "NT Command Line" or "NT Command
>> you'll find loads of resources, and I rather like the book on NT
>> Scripting by Tim Hill (Macmillan 1998). I tend to use plain NT
>> for simple scripts.
>> Other "interpreters" include "Windows Scripting Host" (usually
>> installed as part of Windows) which can interpret Visual Basic
>> Script (VBS)
>> commands, which are much more powerful than the rather creaky NT
>> command-line interface. I tend to use VBS for more complex
>> scripts, as the
>> error-handling in NT scripting is rudimentary. VBS can also
>> interact with
>> Excel and other Office programs in a sophisticated way.
>> More recently another interpreter has become available, and this
>> something like the (awesome and underused) power of Unix scripting:
>> PowerShell. Non-trivial, but immensely powerful. Some of
>> flagship server products are expected to be administered mainly by
>> Powershell scripting in their most recent versions. I got through
>> chapters of the book (still next to my workstation) before other
>> work blew
>> that away...
>> How does this affect RealVNC users? Well, I provide the people I
>> with a simple script which they click to connect to my "listening
>> I've set up port-forwarding at my end to allow port 5500 through to
>> preferred machine, and all Uncle Joe has to do to get my help is
>> double-click the script's icon on their desktop. The advantage of
>> arrangement is that I can deal with firewall problems at my end
>> having to get them to fiddle with such mysteries at their end - it
>> works. I think it would also be possible to create a script which
>> check regularly for a working connection and reconnect if none
>> existed, but
>> that's for another day/month/year.
>> In the past (XP and earlier) I've used a script which pops up an
>> message box first (giving the option to cancel in case of a finger-
>> then checks for a running server and then connects to my hard-coded
>> I'll be happy to send you (or anyone else interested) a copy of
>> this on
>> request. The essential line is:
>> WinVNC4.exe -connect <phils-domain-address>
>> .. where phils-domain-address is a domain name provided by my ISP,
>> an IP address will do. If you have a dynamic IP address, you can use
>> DynDNS.com (free) to set up a domain name which will track your
>> changing IP
>> address (assuming you run the update client on at least one running
>> My original question was about Vista. I've found that including
>> the term
>> "-service" in the line above allows the connection to work (in the
>> configurations I've set up), but I need to modify my script to
>> check whether
>> a server is running as a service or in user-mode, or not at all.
>> Nevertheless, if you get the person needing support to check
>> manually if the
>> server is running (task manager or spot the icon) then that one
>> line may be
>> all you need in a simple script. Lord knows when I'll get round to
>> the modification to my script, but I doubt it'll turn out to be any
>> difficult than what worked well for XP.
>> I must say that the documentation for Command Line use of RealVNC
>> is rather
>> inadequate (or is it just hard-to-find?).
>> Hope that's useful.
>> Philip Herlihy, London
>> -----Original Message-----
>> From: vnc-list-bounces [at] realvnc [mailto:vnc-list-bounces [at] realvnc
>> ] On
>> Behalf Of Dale Eshelman
>> Sent: 21 June 2009 06:11
>> To: Philip Herlihy
>> Cc: vnc-list [at] realvnc
>> Subject: Re: Command-line connection to listening client from Vista
>> I would be interested to know how to create a script in WXP Pro as I
>> have never done it.
>> Can you provide more information on how to create a script to use and
>> how then to use the script?
>> On Jun 20, 2009, at 8:10 AM, Philip Herlihy wrote:
>>> On XP machines I've set up a script which invokes a connection to a
>>> listening client:
>>>> vinvnc4.ext - connect MyClientHost.MyDomain.com
>>> - very useful. This doesn't work on Vista. Can anyone advise on
>>> how I'd do
>>> the equivalent from a command-line or command-file? The Vista box
>>> has VNC
>>> running as a service.
>>> Phil, London
> Dale Eshelman
> eshelmand [at] gmail
> ShopToEarn (Dist ID 105985)
> MonaVie (Distr ID 1316953)
> The closer I get to the pain of glass in Windoz, the farther I can
> see and I see a Mac on the horizon.
eshelmand [at] gmail
ShopToEarn (Dist ID 105985)
MonaVie (Distr ID 1316953)
The closer I get to the pain of glass in Windoz, the farther I can see
and I see a Mac on the horizon.
VNC-List mailing list
VNC-List [at] realvnc
To remove yourself from the list visit: