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

  • Home
  • SEARCH
  • 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 7548527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:43:16+00:00 2026-05-30T09:43:16+00:00

I have a xml files filles with tabs and spaces. I am trying to

  • 0

I have a xml files filles with tabs and spaces. I am trying to search for a string in this file. File is something like below. I am trying to search for </ViewSettings> and this surrounded by tabs and spaces.

<ViewSettings>
  <Location>
  <X>0</X>
  <Y>0</Y>
  </Location>
</ViewSettings>
<WorkspaceName="FREE_UST_BETA_UA" PAth="\\mktxindfs\data_configuration\FREE_BETA"      IsAdmin="false" />
</Workspaces>

I have the code below

echo off
setlocal enabledelayedexpansion

for %%X in (C:\add\WorkspaceXML\Workspaces.xml) do (
set "reference=</ViewSettings>"
for /f "delims=" %%T IN (%%X) do (  
        set output=%%T
        echo output:!output!
        if !output!==!reference! echo found reference.....
    )
)

It does not print “found reference”

Thanks

  • 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-30T09:43:17+00:00Added an answer on May 30, 2026 at 9:43 am

    Have you considered building your batch file off of findstr instead? This command would tell you if the string was in the file by reporting the filename.

    findstr /M /c:"</ViewSettings>" C:\add\WorkspaceXML\Workspaces.xml
    

    EDIT

    If you use findstr /N /O ... instead, you can get the line number and offset of the match(es), maybe that will be of more use to you. The output in your case above would be

    6:69:</ViewSettings>
    

    EDIT 2

    Proper offset added above thanks to dbenham. Not sure if the offset is still of use to you, but to get both values in vars, try this:

    FOR /F "tokens=1,2 delims=:" %%a in ('findstr /N /O /c:"</ViewSettings>" C:\add\WorkspaceXML\Workspaces.xml') do echo %%a %%b 
    

    This just displays the vars for you of course, but you can set them as needed.

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

Sidebar

Related Questions

I have XML files containing data like this... <parent> <boy/> </parent> <parent> <girl/> <parent>
I have an xml file which looks like the below example <Ids> <Id> <set>ai</set>
I have some XML files to parse, some of them are like this: <?xml
I have several xml files that are formated this way: <ROOT> <OBJECT> <identity> <id>123</id>
I have some XML files that contain different function information. I am trying to
I have two XML files. The structure of both XML files is as below:
Suppose I have two XML files. First XML File: <?xml version=1.0?> <AccessRequest xml:lang=en-US> <AccessLicenseNumber>Your_License</AccessLicenseNumber>
I have xml files been imported onto an FTP server. This is stored in
I have xml files with many children and then further more children. like <level1>
I have some xml files with figure spaces in it, I need to remove

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.