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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:22:43+00:00 2026-05-15T16:22:43+00:00

I know this has been asked 100 times before but every bit of code

  • 0

I know this has been asked 100 times before but every bit of code I try just doesn’t seem to work. I am trying to compile a file and then check for a error file and read it line by line and dump it into command line:

This is what I have so far:

Set var1= %1
Set var2= %var1:.mb=.ERR%

echo %var1%
echo %var2%

"C:\Program Files\MapInfo\MapBasic\mapbasic.exe" -D %var1%

FOR /f "delims=" %%a in (%var2%) do echo %%a

So I am taking the path to the file as a command line arg this works fine, then taking the .mb off and replacing it with .ERR and running the program to complie the .mb file, everything works fine up until I hit the for loop.

The result for loop looks like this, when running with echo on:

FOR /F "delims=" %a in ("C:\Documents and Settings\woodrown\My Documents\Visual Studio 2008\Projects\MapInfoInteropTemplate1\MapInfoInteropTemplate1.ERR") do echo %a 

but when it runs it just prints out
"C:\Documents and Settings\woodrown\My Documents\Visual Studio 2008\Projects\MapInfoInteropTemplate1\MapInfoInteropTemplate1.ERR" not the files content.

I can get it to work if I give it a hard name and no path with spaces, such as ‘MapInfoInteropTemplate1.ERR’ but I want it to use %var2% for the file name to read.

If I put ' around the path it just launches my default text editor.

I ended up skipping the whole batch file generation of computer programing so this is really strange to me, sorry if it’s a basic question.

  • 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-15T16:22:44+00:00Added an answer on May 15, 2026 at 4:22 pm

    Use the usebackq option to for:

    FOR /F "usebackq delims=" %%a in ("C:\Documents and Settings\woodrown\My Documents\Visual Studio 2008\Projects\MapInfoInteropTemplate1\MapInfoInteropTemplate1.ERR") do echo %%a  
    

    Otherwise it will interpret whatever you put between double-quoets as a string to tokenize, not as a file to read. This is also stated in the help:

        or, if usebackq option present:
    
    FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
    FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
    FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked a bit before. But looking around I
I know this question has been asked before, but I ran into a problem.
I know this specific question has been asked before , but I am not
I know this has been discussed many times, but I am not sure I
I don't know if anyone has seen this issue before but I'm just stumped.
I know this questions has come up in various guises before, but this is
I don't know if this has been discussed. Let's say you are in a
Ok, I know someone here has tried this ninja-elite level of coding before. Essentially
I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify
This question has been discussed in two blog posts ( http://dow.ngra.de/2008/10/27/when-systemcurrenttimemillis-is-too-slow/ , http://dow.ngra.de/2008/10/28/what-do-we-really-know-about-non-blocking-concurrency-in-java/ ),

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.