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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:29:32+00:00 2026-06-12T09:29:32+00:00

Creating a batch utility script on Windows 7 to invoke an executable. It essentially

  • 0

Creating a batch utility script on Windows 7 to invoke an executable. It essentially works, EXCEPT that my second IF statement. Tried a number of different things.

My intent is to invoke ‘DoSomething’ for each command line argument. That part works!
The second IF statement prints a help message only if there no parameters given on the command line. Well, that’s the intent. That’s not what it’s doing.

@ECHO OFF

:Start
SET a_file_was_processed="false"
IF "%1" NEQ "" (
  SET a_file_was_processed="true"
  ECHO Extracting table %1 from database.
  DoSomething word%1 > output_%1.txt
  ECHO Finished extract table to file output_%1.txt
SHIFT
GOTO Start
)

if a_file_was_processed NEQ "true" (
  ECHO Invoke this script as: Extract_From_sdf  table_name1   table_name2
)

Ideas?

  • 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-12T09:29:33+00:00Added an answer on June 12, 2026 at 9:29 am

    Tried with these changes and seems to work as expected

    @ECHO OFF
    
    SET a_file_was_processed="false"
    :Start
    IF "%1" NEQ "" (
      SET a_file_was_processed="true"
      ECHO Extracting table %1 from database.
      rem --- DoSomething word%1 > output_%1.txt
      ECHO Finished extract table to file output_%1.txt
    SHIFT
    GOTO Start
    )
    
    if %a_file_was_processed% NEQ "true" (
      ECHO Invoke this script as: Extract_From_sdf  table_name1   table_name2
    )
    

    The first obvious error is the label :Start before the setting to false.
    Then to refer to the value of a variable you need to enclose the variable in %

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

Sidebar

Related Questions

I am currently creating a batch script that will import products into a particular
Creating a batch script in Windows XP. Here's a snippet of code I'm having
Here's the case: I am creating a batch script that runs daily, parsing logfiles
I am creating a batch file in windows with the following command in it.
I'm creating a batch file (on Windows Vista) to deploy my project from development
I'm creating emails from a batch script in symfony 1.4 w/ propel Trying to
writting an MSBuild script I have found a problem. I'm creating a batch file
I have a simple FOR loop inside of a batch file I'm creating that
I am creating a batch file to siliently install nodejs on a Windows XP
I am creating a Windows Service in C# that processes messages from a queue.

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.