# Solved: TightVNC and batch file switches?



## DaveDoesIT (Aug 24, 2008)

Hi All,

I have win98se with TightVNC loading as a Service at start up.

At some time, I need to run a DOS program that will not coexist with TightVNC Service so I need to shut the VNC down when I run the DOS app.

I can't seem to find a Switch for shutting TightVNC off in the first line.

REM ROUTER.BAT
REM ------------
Echo off
c:\TightVNC - I need a shut-down switch here
c:\Command.com
cd DOS_APP
Router.exe
cd \
Exit
c:\TightVNC

By loading Command.com and running the router software there, it theoretically should not be influenced by the original VNC Service but it is. A lot of the Router stuff is timing-critical so it is obviously going straight to the CPU rather than through the Command processor loaded in the batch file.

Thanks

Dave


----------



## Squashman (Apr 4, 2003)

I think you would have to install the Windows 98 resource kit and use kill.exe to end the process.


----------



## DaveDoesIT (Aug 24, 2008)

Thanks Squashman, I was able to download just the "kill.exe" from here

ftp://ftp.microsoft.com/services/technet/samples/ps/win98/reskit/diagnose/

I won't mark this "Solved" until I have tested it at removing the service cleanly. Back in a bit. 

Dave


----------



## DaveDoesIT (Aug 24, 2008)

OK, it is solved, but not so simply. Squashman, your "kill.exe" got me started in the right direction though. Thanks.

Kill /f winVNC.EXE

Kill stopped it but must not have replaced or patched some of the winVNC vectors. Also for Kill to work fully it probably needs the pid. To get that you need TList.EXE from "kill" the link above. But the pid will be different for every boot so it is not really useful in a batch file. I guess I could have redirected TList output to a file then read that in. But it gets better.

The good thing about that incomplete "kill," was that winVNC would not run after the Router batch file. What winVNC did do though was display a list of command line switches. Prior to posting here I had checked the TightVNC website and did not much in the way of switches. There were some but nothing to help me.

As it turned out the second in the list was "-kill" bingo.

The batch file now looks like this (note that "progra~1" is the "Program Files" folder but DOS will stop at that first space so the short name has to be used)

REM ROUTER.BAT
REM ------------
echo off
c:
cd \progra~1\tightvnc
tightvnc -kill
cd \DOS_APPS
Router.exe
cd \progra~1\tightvnc
tightvnc -service
exit

Thanks for the kick-start, Squashman.

Use a Command prompt and this will list the switches

c:\progra~1\tightvnc\winvnc /?

Dave


----------



## Squashman (Apr 4, 2003)

yes the PID would change but that is easy enough to parse using a For Loop and the find command.

I was trying to search for the command line options in Google because I didn't want to install it but I must have not put in the correct search terms. Now that I search for WinVNC command line options I find the KILL switch.


----------



## DaveDoesIT (Aug 24, 2008)

Oooops, my mistake, that "tightvnc in the batch file should be "winvnc"

Here's the corrected version...

REM ROUTER.BAT
REM ------------
echo off
c:
cd \progra~1\tightvnc
winvnc -kill
cd \DOS_APPS
Router.exe
cd \progra~1\tightvnc
winvnc -service
exit

Dave


----------

