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 8814021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:00:12+00:00 2026-06-14T04:00:12+00:00

SET CLIENTS=blah1:blah2 for %%x in (%CLIENTS::= %) do ( SET client=%%x echo %client%; if

  • 0
SET CLIENTS=blah1:blah2

for %%x in (%CLIENTS::= %) do (
SET client=%%x
echo %client%;
if "%1"==%client% goto end
)
:end

I would expect to compare blah1 and %1 first and blah2 and %2 second.
However, the %client% will only be assigned with blah2. Any ideas how to resolve this issue?

  • 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-14T04:00:13+00:00Added an answer on June 14, 2026 at 4:00 am

    The expansion of variables inside FOR loops requires you to enable delayed expansion to force variables to be expanded at runtime instead of being expanded when parsed. Read HELP SET for more information.

    And try changing your code to

    @echo off
    setlocal enabledelayedexpansion
    SET CLIENTS=blah1:blah2
    set CLIENTS=%CLIENTS::= %
    for %%x in (%CLIENTS%) do (
      SET client=%%x
      echo !client!;
      if "%1"=="!client!" goto end
      )
    :end
    

    Note that the variable is referenced with an slightly different syntax !client! instead of %client%. Delayed environment variable expansion allows you to use a different character (the exclamation mark) to expand environment variables at execution time.

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

Sidebar

Related Questions

I would like to set up a login area for my clients at my
The location text from Twitter could be just about anything. Sometimes Twitter clients set
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
In a MongoDB replica set, Does master node need to be accessible from clients?
I've got a basic HTTP client set up in C++, which works ok so
I have a potential client that set up their website and membership system in
I am using client bundle in gwt.Using client bundle set image on label,open pdf
I have set up an AJAX contact form on a client's website. The problem
I have a set of webservices that I connect to using Silverlight Client. I
I managed to set up a server(on PC) and a Client (on device) thru

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.