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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:59:27+00:00 2026-06-10T13:59:27+00:00

I’m trying to use a batch file to find a particular section on a

  • 0

I’m trying to use a batch file to find a particular section on a .cfg file, and use that as a variable.

Specifically, I’m trying to read Idapi32.cfg (Borland configuration file), to find the path to one the alias’ inside it.

I couldn’t think of any way to do this neatly, so I’ve been trying to do this:
– use CMD’s TYPE feature to get the .cfg file as a string (its one line of text) and set this string to a variable
– take the first five characters of that variable, and use IF string1==string2 to see if the first five characters are the section I need
– if not, reset the variable to be the same minus the first character and check again.

I know that my loop works, because I can see it working, but I can’t understand why I get different results between running

TYPE "C:\programdata\borland shared\bde\idapi32.cfg"

and

for /f "usebackq tokens=* delims==" %%a in (`type "c:\programdata\borland shared\bde\idapi32.cfg"`) do (echo %%a)

I would expect the echo to be identical to the TYPE command results?? Or am I missing something??

Edit
I’ve just added the results of the TYPE and the FOR, to show the difference in results

C:\>type "C:\programdata\borland shared\bde\idapi32.cfg"
♥   DRIVERS ☺ ♥   PARADOX ☺ ♥   INIT ☺ ♥ ☺ NET DIR ♦ W:\WINFILES ☻ ☻ ☻ ♥   DATAB
ASES ☺ ♥   MS Access Database ☺ ♥   DB OPEN ☺ ♥ ☺ DATABASE NAME ♦  ♥ ☺ USER NAME
 ♦  ♥ ☺ ODBC DSN ♦ MS Access Database ♥ ☺ OPEN MODE ♦ READ/WRITE ♥ ☺ SCHEMA CACH
E SIZE ♦ 8 ♥ ☺ SQLQRYMODE ♦  ♥ ☺ LANGDRIVER ♦  ♥ ☺ SQLPASSTHRU MODE ♦ SHARED AUT
OCOMMIT ♥ ☺ SCHEMA CACHE TIME ♦ -1 ♥ ☺ MAX ROWS ♦ -1 ♥ ☺ BATCH COUNT ♦ 200 ♥ ☺ E
NABLE SCHEMA CACHE ♦ FALSE ♥ ☺ SCHEMA CACHE DIR ♦  ♥ ☺ ENABLE BCD ♦ FALSE ♥ ☺ RO
WSET SIZE ♦ 20 ♥ ☺ BLOBS TO CACHE ♦ 64 ☻ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ Microsoft Acce
ss Driver (*.mdb) ♥ ☺ PATH ♦  ☻ ☻ ♥   Excel Files ☺ ♥   DB OPEN ☺ ♥ ☺ DATABASE N
AME ♦  ♥ ☺ USER NAME ♦  ♥ ☺ ODBC DSN ♦ Excel Files ♥ ☺ OPEN MODE ♦ READ/WRITE ♥
☺ SCHEMA CACHE SIZE ♦ 8 ♥ ☺ SQLQRYMODE ♦  ♥ ☺ LANGDRIVER ♦  ♥ ☺ SQLPASSTHRU MODE
 ♦ SHARED AUTOCOMMIT ♥ ☺ SCHEMA CACHE TIME ♦ -1 ♥ ☺ MAX ROWS ♦ -1 ♥ ☺ BATCH COUN
T ♦ 200 ♥ ☺ ENABLE SCHEMA CACHE ♦ FALSE ♥ ☺ SCHEMA CACHE DIR ♦  ♥ ☺ ENABLE BCD ♦
 FALSE ♥ ☺ ROWSET SIZE ♦ 20 ♥ ☺ BLOBS TO CACHE ♦ 64 ☻ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ M
icrosoft Excel Driver (*.xls) ♥ ☺ PATH ♦  ☻ ☻ ♥   dBASE Files ☺ ♥   DB OPEN ☺ ♥
☺ DATABASE NAME ♦  ♥ ☺ USER NAME ♦  ♥ ☺ ODBC DSN ♦ dBASE Files ♥ ☺ OPEN MODE ♦ R
EAD/WRITE ♥ ☺ SCHEMA CACHE SIZE ♦ 8 ♥ ☺ SQLQRYMODE ♦  ♥ ☺ LANGDRIVER ♦  ♥ ☺ SQLP
ASSTHRU MODE ♦ SHARED AUTOCOMMIT ♥ ☺ SCHEMA CACHE TIME ♦ -1 ♥ ☺ MAX ROWS ♦ -1 ♥
☺ BATCH COUNT ♦ 200 ♥ ☺ ENABLE SCHEMA CACHE ♦ FALSE ♥ ☺ SCHEMA CACHE DIR ♦  ♥ ☺
ENABLE BCD ♦ FALSE ♥ ☺ ROWSET SIZE ♦ 20 ♥ ☺ BLOBS TO CACHE ♦ 64 ☻ ♥   DB INFO ☺
♥ ☺ TYPE ♦ Microsoft dBase Driver (*.dbf) ♥ ☺ PATH ♦  ☻ ☻ ♥   Text Files ☺ ♥   D
B OPEN ☺ ♥ ☺ DATABASE NAME ♦  ♥ ☺ USER NAME ♦  ♥ ☺ ODBC DSN ♦ Text Files ♥ ☺ OPE
N MODE ♦ READ/WRITE ♥ ☺ SCHEMA CACHE SIZE ♦ 8 ♥ ☺ SQLQRYMODE ♦  ♥ ☺ LANGDRIVER ♦
♥ ☺ SQLPASSTHRU MODE ♦ SHARED AUTOCOMMIT ♥ ☺ SCHEMA CACHE TIME ♦ -1 ♥ ☺ MAX ROWS 
♦ -1 ♥ ☺ BATCH COUNT ♦ 200 ♥ ☺ ENABLE SCHEMA CACHE ♦ FALSE ♥ ☺ SCHEMA CACHE DIR 
♦  ♥ ☺ ENABLE BCD ♦ FALSE ♥ ☺ ROWSET SIZE ♦ 20 ♥ ☺ BLOBS TO CACHE ♦ 64 ☻ ♥ DB IN
FO ☺ ♥ ☺ TYPE ♦ Microsoft Text Driver (*.txt; *.csv) ♥ ☺ PATH ♦  ☻ ☻ ♥   MS Acce
ss 97 Database ☺ ♥   DB OPEN ☺ ♥ ☺ DATABASE NAME ♦  ♥ ☺ USER NAME ♦  ♥ ☺ ODBC DS
N ♦ MS Access 97 Database ♥ ☺ OPEN MODE ♦ READ/WRITE ♥ ☺ SCHEMA CACHE SIZE ♦ 8 ♥
 ☺ SQLQRYMODE ♦  ♥ ☺ LANGDRIVER ♦  ♥ ☺ SQLPASSTHRU MODE ♦ SHARED AUTOCOMMIT ♥ ☺ 
SCHEMA CACHE TIME ♦ -1 ♥ ☺ MAX ROWS ♦ -1 ♥ ☺ BATCH COUNT ♦ 200 ♥ ☺ ENABLE SCHEMA
 CACHE ♦ FALSE ♥ ☺ SCHEMA CACHE DIR ♦  ♥ ☺ ENABLE BCD ♦ FALSE ♥ ☺ ROWSET SIZE ♦ 
20 ♥ ☺ BLOBS TO CACHE ♦ 64 ☻ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ Microsoft Access Driver (*
.mdb) ♥ ☺ PATH ♦  ☻ ☻ ♥   NewSites ☺ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ STANDARD ♥ ☺ PATH 
♦ C:\welcome\progs\sitesdatasetups\hoste\book ♥ ☺ ENABLE BCD ♦ FALSE ♥ ☺ DEFAULT
 DRIVER ♦ PARADOX ☻ ☻ ♥   WinPOS32DB ☺ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ STANDARD ♥ ☺ PAT
H ♦ C:\TaskPOS\WINPOS~1\ ♥ ☺ ENABLE BCD ♦ FALSE ♥ ☺ DEFAULT DRIVER ♦ Paradox ☻ ☻
 ♥   PreparationDB ☺ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ STANDARD ♥ ☺ PATH ♦ C:\TaskPOS\Win
POS32DB ♥ ☺ ENABLE BCD ♦ FALSE ♥ ☺ DEFAULT DRIVER ♦ PARADOX ☻ ☻ ♥   IOLiteW21125
25165259313 ☺ ♥   DB INFO ☺ ♥ ☺ TYPE ♦ STANDARD ♥ ☺ PATH ♦ W:\Book ♥ ☺ ENAB

It goes on…

C:\>for /f "usebackq tokens=* delims==" %a in (`type "c:\programdata\borland sha
red\bde\idapi32.cfg"`) do (echo %a)

C:\>(echo ♥SQLQRYMODE♦IOLiteW2112525165259313☻ )
♥SQLQRYMODE♦IOLiteW2112525165259313☻

If I could get the full result of the “TYPE” command above into a variable, I can work with it (I think)… I just can’t work out why the results of the FOR are different?

  • 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-10T13:59:28+00:00Added an answer on June 10, 2026 at 1:59 pm

    Looks like you are working with a binary file.

    CMD does not play nicely with null characters.

    Also CMD is limited to 8191 characters per line.

    So it looks like your efforts to use CMD are doomed unless you use some 3rd party tool that can process a binary file. Or switch to another language like VBScript or JScript.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.