Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:39:06+00:00 2026-06-08T10:39:06+00:00

Can someone help me with this one? I have a batch file, where I

  • 0

Can someone help me with this one? I have a batch file, where I am trying to connect a couple network drives based on my current internal IP address. Problem is, it is outputting the following:

Home 192.168.2.99
Basement

Where it should be just outputting:
Home 192.168.2.99

Here’s the code:

@echo off

@for /F "tokens=2 delims=:" %%i in ('"ipconfig | findstr IP | findstr 192."') do SET LOCAL_IP=%%i

@if ("%LOCAL_IP%" == "192.168.2.99") Call ConnectHome else (Call ConnectBasement)


:ConnectHome
@echo Home %LOCAL_IP%

:ConnectBasement
@echo Basement
@REM net use R: \\192.168.2.98\Storage
@REM net use S: \\192.168.2.98\MyStuff
@REM net use T: \\192.168.2.98\Server

I’ve also tried replacing the IF statement with:

@if ("%LOCAL_IP%" == "192.168.2.99") goto ConnectHome else (goto ConnectBasement)

and:

@if ("%LOCAL_IP%" == "192.168.2.99") goto :ConnectHome else (goto :ConnectBasement)

and the results are always the same…
OS is Windows 7 Pro

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:39:07+00:00Added an answer on June 8, 2026 at 10:39 am

    Call is intended to call a different batch file from the one you’re currently in (see here). If it’s passed a label, it will execute from that label, but it’ll execute to the end of the file, so it won’t stop when it hits the :ConnectBasement line.

    What you probably need is to add a label :END at the bottom of the file, and Goto :END just before your :ConnectBasement line. For consistency I’d probably suggest using Goto instead of Call throughout. (You can also use Goto :EOF without defining a label, if you wish.)

    (Or, learn PowerShell and use its functioning capability to implement this more cleanly ;-))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone help me out with this one. I have a page, in which
I'm hoping someone can help on this one, I have created a custom object
Okay, the specs have changed on this one somewhat. Maybe someone can help me
I wish someone can help me with this one. I have a Spring MVC
Hope someone can help me out with this one ! I have a sql
Can someone help me create an index/count button for a UITableView, like this one?
Perhaps someone can help me out with this one: I'm using a basic search
can someone help me with this? I have an AlertDialog box and its working
I'm finding this a bit tricky! Maybe someone can help me on this one
I hope someone can help me with this one, I suspect I am doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.