HypatiaCommand Line Tools — WITH


WITH is a Windows command line tool that lets you do whatever you can do from the command line, with all or with selected files in a folder. It can be seen as an alternative to the Windows FOR command, but takes a different approach.

Current version: 1.01 (April 4, 2023), download link see below.

This is a bugfix release, please update if you have an older version.



with [options] files command

with [options] files1 [files2 files3 ...] do command

Executes 'command' for all files matching 'files' in the current folder

'files' can contain wildcard characters ? or *, a single asterisk * can stand for *.*

Several filename match patterns ('files1' 'files2' …) can be processed, but they must be separated from 'command' by the word 'do'

'files1' 'files2' etc. will be processed consecutively

File names get read before processing starts

If a file matches more than one match pattern, it will be called each time

with -? displays the help text

'Command' can contain the following symbols:

*.*  stands for the full file name

*  can be used instead of *.* when it occurs as a separate word

*.  stands for the file name without extension, including the dot

*'  stands for the file name without extension, not including the dot

.*  stands for file extension, including the dot

'*  stands for file extension, not including the dot

Enclose redirection/pipe symbols < > | in " " to make them part of 'command'

° can be used for spaces in file names, both in 'files' and 'command'

˛ stands for double quotes meant to be included in 'command'

If you need ° to stand for itself, you have to use the option -° (see below) and, if necessary, enclose file names with spaces in " "

If you need ˛ to stand for itself, you have to use the option -˛ (see below)


-q — quiet, don't display commands

-n — display number of files at the end

-t — test only, don't execute

-° — do NOT substitute ° with space character

-˛ — do NOT substitute ˛ with "


Download and Installation

Download program file, documentation and source files:

with.zip Version 1.01 (April 4, 2023), 0.18 MB

Unpack the zip file (with.exe, the documentation file with.txt, and the folder \source) and move or copy with.exe to a folder that is included in the system path; you can then use it from the Windows command line prompt. Nothing gets written to the registry. To uninstall, simply delete.

Delete the source files, if you do not need them. This program is written in Phix, version 1.0.2 phix.x10.mx

Disclaimer: I have tested this program and am using it myself, but I cannot guarantee its correct function under all circumstances. Use it with caution, and consider backing up your data before executing commands that may involve deleting or overwriting files. Incorrect use can lead to loss of data.



with *.jpeg ren * *.jpg

renames all files *.jpeg to *.jpg

with *.txt copy * *'°backup.txt

copies all files *.txt to * backup.txt ("mytext backup.txt")

with *.log *.ini do copy * *.*.backup

copies all files *.log and *.ini to *.*.backup ("mylog.log.backup")

with *.txt type * ">>" full.txt

writes content of all .txt files to full.txt
(This file should not already exist, or its own content would be added to itself)

with *.rw2 if not exist *.jpg del *

deletes those .rw2 files whose corresponding .jpg files have been deleted.

This is actually what made me want to write this tool. My camera writes two files for each picture, .jpg and the "raw" file .rw2 — with an image viewer I browse the .jpg files and delete the ones I don't want to keep, which leaves the corresponding .rw2 files to be deleted.

If you mistype the "if" clause in the above example, all your .rw2 files may be gone -- this is a safer method:

with *.rw2 if not exist *.jpg ren * *.*.delete

adds the extension .delete to the files instead of deleting them. You can now check the result and then use del *.delete

Note that * stands for the full file name when it's a separate word, but *.* is needed in the renamed file.


with *.rw2 if not exist *.jpg ren * *.delete

would rename myfile.rw2 to myfile.delete (without the original file extension), instead of myfile.rw2.delete

If you want to execute more complex tasks, you can call a .cmd batch file, like:

with * mybatchfile.cmd *

For a discussion of quotation marks and redirection/pipe symbols, see with.txt



This program, including the source code, is freeware. Do with it whatever you like. If you have any questions, suggestions, complaints or comments, I’ll be glad to hear from you.

Please report bugs, ask questions, make suggestions, etc.

Robert Schaechter, robert@drs.at



April 4, 2023 – Bugfix release 1.01, please update if you have an older version

March 26, 2023 – Version 1.0 published here on the hypatia-rpn.net website

Prior versions of ths tool had been published on www.dunyazad-library.net/software/

Back to the “Tools” page