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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:48:40+00:00 2026-05-25T02:48:40+00:00

I am trying to use Windows built-in shell script to load this file: hostname1,host_specific_file1

  • 0

I am trying to use Windows built-in shell script to load this file:

hostname1,host_specific_file1
hostname2,host_specific_file2
hostname3,host_specific_file3
.
.
.

Like this:

for /f "tokens=1,2* delims=," %%i in (host-info.txt) do set clientName=%%i; set fileLoc=%%j

Which doesn’t work but I want it to go like this:

:loop
For each line, Set the current_hostname=hostnamex and Set the current_file=host_specific_filex
And THEN
DO STUFF
Goto next line, Goto loop

Is there a method for doing this? I can’t get my script wrapped around the “Goto next line” or “Handle one line at a time” concept.

Thanks,
Chris

  • 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-05-25T02:48:40+00:00Added an answer on May 25, 2026 at 2:48 am

    You can;

    echo off
    setlocal enabledelayedexpansion
    
    for /f "tokens=1,2* delims=," %%i in (host-info.txt) do (
        set clientName=%%i
        set fileLoc=%%j
        call:handler
    )
    goto:eof
    
    :handler
        echo client name is !clientName! location is !fileLoc!
    goto:eof
    

    Or Using %n notation;

    echo off
    setlocal enabledelayedexpansion
    
    for /f "tokens=1,2* delims=," %%i in (host-info.txt) do call:handler %%i %%j
    goto:eof
    
    :handler
        echo client name is %1 location is %2 ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use NAnt/NAntContrib build script to build a web application on Windows
I am trying to use Windows Workflow and have a model that looks similar
I am trying to use windows dll functionality in Linux. My current solution is
I am trying to use native windows API with Qt using mingw toolset. There
I'm trying to use Integrated Windows Authentication combined with a DirectorySearcher to identify and
I'm trying to use git on windows to clone a remote repository. I can
I am trying to use WpfToolkit DataGrid in Windows Phone 7 project (Silverligt 4)
While trying to use LINQ in a .NET 2.0 Windows Forms project I got:
I am trying to use MinGW to compile a C program under Windows XP.
Hi I'm trying to use mono-service2 to run a stock Windows Service Project from

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.