You could do something like this:
net start | find /i "vnc server"
if not errorlevel 1 goto :OldInstall
Or, if you need the Service variable set for later use:
set Service=
net start | find /i "vnc server"
if not errorlevel 1 set Service=VNC Server
if defined Service goto :OldInstall
> -----Original Message-----
> From:
batchworld@...
> [mailto:
batchworld@...] On Behalf Of Gary Kuznitz
> Sent: Thursday, May 29, 2008 3:23 PM
> To:
batchworld@...
> Subject: [BATCH WORLD] "VNC Server" was unexpected at this time
>
> I'd like to find out if there is a service installed in XP
> called VNC Server. If there is I'd like to goto :OldInstall
> This is the code I have:
>
> setlocal
> Set Service = " "
> net start|find /i "VNC Server" >Service
> Echo %Service%
> If Service="VNC Server" &&goto :OldInstall
>
> The Echo to display the variable isn't working.
> I'm getting an Error
> ="VNC Server" was unexpected at this time.
>
> If Service="VNC Server" &&goto :OldInstall
>
> I have tried:
> If %Service%="VNC Server" &&goto :OldInstall
>
> I must be doing something wrong. Any ideas?
>
> Thank you,
>
> Gary Kuznitz