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

The Archive Base Latest Questions

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

I have a program that I need to run via command line that I

  • 0

I have a program that I need to run via command line that I want to make a batch file for to save time. It looks for any files in the same directory with a specific extension and then runs the exe to manipulate the file. Something like:

example.exe option1 *.ext

Where .ext is a file with the correct type of extension it’s looking for. The file type usually has different filenames, but always the same extension. The option is just something the program knows how to use so that can be ignored for now.

Trick is I only want this to run IF there isn’t already another file in the same directory with the same name but a different extension.

I think I saw something about being able to use IF statements in batch files, but I have no idea how this would be done. Any 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-13T17:32:13+00:00Added an answer on June 13, 2026 at 5:32 pm
    echo off
    
    REM search .txt files.
    for %%f in (*.txt) do (
      REM skip if a .log file with the same name exists.
      if not exist %%~nf.log (
    
        echo Now executing %%f
        notepad.exe %%f
        REM Terminate the loop after the first succesful file
        goto end
    
      ) else (
        echo Skipping %%f
      )
    )
    
    echo Nothing to process.
    
    :end
    pause
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# command-line application that I need to run in windows and
I have a legacy program that I need to run with the extension of
I have a program that I need to be able to search a file
I have a program that looks like this. I need to consistently write something
I need to make the program which have one form that contains PNG image
Well, i have this program i need to run via either functions however it
I need to run a program that will have a similar output both on
I have created a Java program which takes some command line arguments to run.
I have a program that creates multiple text files of rdf triples. I need
I have a program that is written in Ada, and I need to compile

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.