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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:26:25+00:00 2026-05-30T11:26:25+00:00

Using Windows XP, I created a batch-file that takes two files as arguments, and

  • 0

Using Windows XP, I created a batch-file that takes two files as arguments, and now I want to add a file-type action “compare” to specific extensions, e.g. “.txt” that calls the batch-file with two selected files. That is I want to select two “.txt” files, and then select “compare” from the shell context menu and have it execute the batch-file with those two files.

I can easily add the “compare” action to the “Text Document” file-type, and select the batch-file with two arguments, e.g. “C:\batch.bat” “%1” “%2” (btw: this works fine from cmd and in other programs, e.g. Git difftool), but then if I select 2 files and try compare them, Windows opens two separate instances for each of the two selected files instead of comparing them.

I checked google and SO but could not find any reference of how to obtain the files as arguments to pass to the file-type action. Thanks!

  • 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-30T11:26:27+00:00Added an answer on May 30, 2026 at 11:26 am

    This question is a duplicate.
    It is addressed here:
    How to pass in multiple file/folder paths via a right-click event (verb) to an executable?

    and here:
    How to add new items to right-click event on Folders and Files in Windows?

    and is similar to this unanswered question on superuser:
    Creating Context Menu Item For Multiple Files

    In a nutshell, when you select 2 files and then choose an action from the context menu (a “verb” in windows shell parlance), windows will always open 2 seperate instances, unless your application has a check to see if it is already running. The trick then is to include in your application (the batch file in my case) an alternate method to execute. This can be achieved as Factor Mystic and Remy Lebeau – TeamB both point out by using an Interprocess Communication (IPC) such as Dynamic Data Exchange (DDE). Factor Mystic also list some good MSDN references for this. Also there is a quick and dirty way suggested by lowlevel using SendTo.

    Here’s my quick and dirty way:

    @ECHO off
    SETLOCAL
    IF NOT EXIST C:\file.tmp (
        ECHO %1 > C:\file.tmp
    ) ELSE (
        FOR /F "TOKENS=*" %%A IN (C:\file.tmp) DO (
            DEL C:\file.tmp
            C:\BATCH %1 %%A
        )
    )
    SETLOCAL
    

    This is the application I use for the file-type action “verb” and it only takes one variable. I did not use DDE, because I cache the first file on the drive. Then call the real application (BATCH) from the first one, once I have both files. Obviously it has problems when odd #s of files are called, but like I said it’s quick and dirty.

    Anyway, I’m closing this since I believe there is an abundance of info on how to solve this the correct way.

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

Sidebar

Related Questions

I'm new to Windows batch files, but I'm writing a .bat file that just
I have two .exe file and 3 windows batch files and i need to
I have a Windows CGI created with Delphi 2007 using CGIExpert that I need
I have created a Windows Forms application in .NET 2 using C# that runs
I'm using VB9 (VS2008). I've created a Windows Service that indexes some folders regularly.
I created a windows batch file with the following content: plink -batch PuttySaveSessionName -pw
I have a batch file that creates a scheduled task using schtasks like this:
Currently I'm using a Windows batch file to build my software. It does things
I have a windows batch file, which iterates over files in a folder and
I am using Windows Form and MySQL for my project. In that i want

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.