Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Need Help with a Batch File


  • Please log in to reply

#1
dmvelasquez

dmvelasquez

    New Member

  • Member
  • Pip
  • 2 posts
I am running Windows XP pro on a laptop. I am trying how to conditional launch some programs based on my hardware profile. WHen I am docked, I want to launch some programs that I do not want to launch when the laptop is not docked.

I was trying to use a batch file and DEVCON, but I am not having any success.

I wrote a batch file in to see if DEVCON sees the docking station.

devcon status ACPI\DOCK*| find "running"
ECHO errorlevel: %errorlevel%
IF errorlevel 0 GOTO SUBA

:SUBA
c:\altiview.lnk
c:\HPDigitalImagingMonitor.lnk
:END
Exit

I do get "0" returned when the docking station is not present and "1" returned when it is not. However, in either case the "SUBA" commands are executing. I only want to run SUBA when the docking station is not present.

What am I doing wrong?

Thanks for your help and time.
  • 0

Advertisements


#2
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
try adding exit, as below:

IF errorlevel 0 GOTO SUBA
exit
:SUBA

...
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP