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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:05:22+00:00 2026-05-23T15:05:22+00:00

I have an ini file that gets autogenerated. Its second line is always: Version

  • 0

I have an ini file that gets autogenerated.

Its second line is always:
Version = W.XX.Y.ZZ

Where W is the major version number, XX is the minor version, Y is the Build and ZZ is the Revision.

I need to open that ini file and edit that line using a batch file so that the build and revision numbers in that version get removed. Therefore, the line should end up like this:
Version = W.XX

The major number will always be one character and the minor number will always be two, therefore the entire string is 14 characters (inc spaces) long.

I was hoping that I could get the string that is LEFT 14 characters of that line and replace that line with that string.

  • 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-23T15:05:23+00:00Added an answer on May 23, 2026 at 3:05 pm

    The “LEFT” syntax you’re asking for is to use a variable substring expansion: %var:~,14%

    The following code will perform a “LEFT 14” on every line that contains the string “Version”

    setlocal enabledelayedexpansion
    del output.ini
    for /f "tokens=*" %%a in (input.ini) do (
      set var=%%a
      if not {!var!}=={!var:Version=!} set var=!var:~,14!
      echo.!var! >> output.ini
    )
    endlocal
    

    If there are other lines with the word “Version”, you can also modify the loop to use a counter.

    setlocal enabledelayedexpansion
    del output.ini
    set counter=0
    for /f "tokens=*" %%a in (input.ini) do (
      set var=%%a
      set /a counter=!counter!+1
      if !counter! EQU 2 set var=!var:~,14!
      echo.!var! >> output.ini
    )
    endlocal
    

    Note that in both cases, you might have to do more work if your file contains special symbols like |, <, or >

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

Sidebar

Related Questions

I have an INI file that I want to read the line DeviceName=PHJ01444-MC35 from
I have a loop that finds duplicate lines in a .ini file. I can
I have a perl script that's reading an INI file like this: [placeholder_title] Hostname
I have the following line in my IsapiRewrite.ini file: RewriteRule ^/test-url.asp$ http://www.google.co.uk/ [R=301,L] But
I have a feeling that Apache is using a different php.ini file that the
I have an INI file that has been created by an AutoHotKey program written
I have created an ini file that installs/creates a SQL Server instance. I am
I have a build in TFS 2008 that gets triggered for every check-in, and
I have ini file that I read in my program. The ini file need
Each Pyramid application has an associated .ini file that contains its settings. For example,

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.