Windows Console Utilities

I wrote these console applications to solve specific problems where there were no clean solutions available using batch commands. As is standard for free software, it is provided as-is, with no support or guarantees*.
These programs are written in Delphi, and have been tested in Windows XP, Windows 7, and Windows 10 environments.

ArcAttribClear

This program has one function - to clear all the Archive attribute bits on a drive. You might want to do this after using a drive image program, if you subsequently use an incremental backup process between creating a drive image. You would think that ATTRIB -A *.*  /S would work, but it doesn't. It will ignore read-only, hidden, and system files. This program clears the archive attribute of every file, regardless of the state of other attributes
Download ArcAttribClear  (48K)

CheckProcesses

This program returns ErrorLevel = 1 if the process name provided on the command line is running. The match is not case-sensitive. The name on the command line can be partial - for example "Checkprocesses.exe powerp" will match  a task called POWERPNT.EXE.
Usage: CheckProcesses <ProcToMatch> {/F"filename.txt"} {/Q}   
      ProcToMatch is process name. Returns ErrorLevel 1 if running'
      /F - save process list to file
      /Q - Quiet mode. Does not list all processes
       
Download CheckProcesses  (362K)

Date2Env and DateTime2Env

These programs set an environment variable with the current date or current date/time string. As far as I can tell it is impossible to make a change to the global environment from a program under Windows 2K/XP/W7/W10. Therefore, these programs generate a batch file, TMPSET.BAT, that has to be called as the next step in your batch file:

DateTime2Env Usage:
ECHO .
DateTime2Env DTSTRING
CALL TMPSET.BAT
MyProgram.exe UniqueFileName_%DTSTRING%.txt
ECHO .

Date2Env Usage:
Usage: Date2Env EnvVar                           
Date2Env creates TMPSET.BAT, which has to be CALLed next in batch file
TMPSET.BAT sets EnvVar to date code in form yymmdd

Date2Env3 Usage:
Usage: Date2Env3 EnvVarY EnvVarM  EnvVarD
Takes today's date and writes it as 3 environment veriables Y, M and D
Date2Env3 creates TMPSET.BAT, which has to be CALLed next in batch file
TMPSET.BAT sets EnvVarY to year in form yyyy
TMPSET.BAT sets EnvVarM to month in form mm
TMPSET.BAT sets EnvVarD to day in form dd



Download Date2Env  (88K) Download Date2Env3  (88K)  Download DateTime2Env  (88K)

DeleteOlderThan

This program deletes files older than a given number of days. It attempts to delete to the recycle bin. It works with UNC paths.

Usage:  DeleteOlderThan  <path_to_file_wildcard> /Dn (where n is days old)
Default days old is 1
/P for Preview (no deletes)
/Q for Quiet (no console output)
/H for this Help

Examples:
DeleteOlderThan C:\path\to\old\files\*.* /D14
DeleteOlderThan "C:\path with spaces\*.*" /D14

Download DeleteOlderThan  (47K)   Version 1.1 2-20-2015

DirTreeDate

This program helps to manage DVD archiving. It allows the creation of a "sliding window" archive of a large file set on DVDs. The rationale is that if you are going to burn a DVD, instead of just including the files that are new or changed since the last archive, why not include as many as will fit, going back in time as far as possible to fill the capacity? This provides some redundancy in case a DVD goes bad someday. DirTreeDate creates a batch file to copy the newest files from the group that will fit on a DVD to a destination path. From the destination path, it is simple to create a DVD by dragging the entire directory structure to the burning program. DirTreeDate accounts for the 2K block allocation of CDR and DVDRs, so if you have billions of 10 byte files it will not exceed the media capacity.
DirTreeDate V1.20 12-31-2007
Usage: DirTreeDate <sourcepath> <destpath> [excludelist] [/Snnn]
Source Path must exist; Dest Path must _not_ exist
Exclude list is a text file of paths on the source that are not to be included
/Snnnn - specify media capacity as nnnn Mbytes. Default is 4570
/H    -  This Help.


Note that DirTreeDate does not copy the files - it generates a batch file, which is then run to perform the actual copy. This allows for a visual "sanity check" before starting the copy operation. It also generates a log file, a list file (containing all files on the source path), and a size file (containing a list of files in the compilation, sorted from largest to smallest), to aid creating the exclude file. The exclude file should contain one path per line.
Download DirTreeDate  (395K)

DisplayResSet

Windows 7 and later do not allow setting some display resolutions (I.E. 640x480) through the display resolution setting dialog. While not useful for a user display, these resolutions may be required by special purpose displays or other purposes. If the mode is supported by the driver, this command line utility will let you access it.  It directly calls the underlying Windows API functions EnumDisplaySettings and ChangeDisplaySettingsEx.
Usage: DisplayResSet.exe /H -    This help
       DisplayResSet.exe with no parameters - list current display devices and supported modes
       DisplayResSet.exe /Dn /Xxxx /Yyyy - set resolution of device n to xxx by yyy pixels
       DisplayResSet.exe /Q - Quiet mode - suppress console output
Download DisplayResSet  (47K)

ExistDir

This program is used in batch files. It simply returns an Errorlevel of 1 if the directory provided on the command line does not exist.
Download ExistDir  (41K)

FilesWithinSecs

This program is used in batch files. It locates files matching a filespec that are either Modified or Created within a specified  number of seconds
Usage: FilesWithinSecs <filename_wildcard> /S<age_secs>
       /B<filename>   write out results to CMD file (filename)
       /C<text>       precede found file with "text" in CMD file
       /V             Verbose Mode - print debugging information
       /Q             Quiet Mode - Limited output (precedence over Verbose mode
       /R             Use cReation Time of file, not modified time
       Version 1.3 3/29/2014
FilesWithinSecs  (386K)

FindInPipe

This program is used in batch files. The output (STDOUT) or error output (STDERR) is piped from another application to FindInPipe. FindInPipe looks for up to 10 search phrases, and sets the returned errorlevel depending on which (if any) phrases are found.
Usage: FindInPipe <search text> [other search texts] [/switches]
Returns errorlevel > 0 if search text(s) found in STDIN
   (errorlevel corresponds to position of text in list of arguments)
Returns errorlevel = 0 if there are no matches
/Q Quiet - does not echo input to output
/U Uppercase - case-insensitive comparison
/R Report - displays if search string was found
/N iNverts return value: returns errorlevel 1 for "Not Found", 0 for "Any Found"

 1 to 10 search texts can be used. Use quotes if texts have embedded spaces.
 Errorlevel of highest parameter found is returned

.
How to pipe STDOUT and STDERR to FindInPipe using 2>&1  (WIN 2K, XP, W7)
net view %2 2>&1 | FindInPipe "error" "not supported"
Download FindInPipe  (47K)

MoveEudoraAttach

This program is intended to be a helper application for use with Eudora filters. The purpose is to move an attachment to a specific folder other than the default attachments folder.
It is used as part of a filter, using the "Notify Application" action. For each custom folder you want to send attachments to, create a filter with a "Notify Application" action, and change the attachment_path to the appropriate folder.
In the command line portion of the "Notify Application" action, use command like this
 MoveEudoraAttach.exe %6 <attachment_path>
The "%6" parameter is required - put it in the command line exactly as shown. It tells Eudora to provide the path to a temporary file containing the message text. If MoveEudoraAttach.exe is not on the system path, then add a path prefix to it as well, and use quotes around any paths that contain spaces. (for example "C:\Program Files\Eudora\MoveEudoraAttach.exe"). I normally put MoveEudoraAttach in the same folder as Eudora.exe, but it will work from anywhere, such as your Windows folder.

One important caveat regarding this program - this program will break the link to the attachment file contained in the message within Eudora. Eudora puts the default location in the mailbox file to generate the clickable link. Fixing this issue is not possible within the constraints of an external program. It would require a plug-in or a change to the Eudora program. Personally, I receive enough attachments that the default behavior of Eudora (dumping all attachments into a single folder) is totally unusable. The minor inconvenience of having to use other shortcuts to go to the various attachment folders is a reasonable tradeoff for keeping the attachments organized in a manageable way.

Download MoveEudoraAttach  (59K)

OlderThan

This program is used in batch files. It simply returns an Errorlevel of 1 if the file on the command line is older than a specified number of days;
Usage: OlderThan <days> <filename>
Returns Errorlevel 1 if file is older than # days
/Q quiet mode - no output to console


Download OlderThan  (46K)


TimeStampPipe

TimeStampPipe - a Windows command line program used to add time-stamps to output data piped from other command line programs.
         Useful for log files and process monitoring.

Usage: TimeStampPipe  [OutFileName] [/switches]

Inserts timestamps at start of lines piped into this program

Command Line Switches:
/P Ping Mode - parses ping command
/Xn Parses out only token n from input line
/Tn Trims off first n characters of input line or token
/F Only timestamp first line, then indent the rest
/E Also write timestamp to STDERR (usually screen unless redirected)


Usage (in Windows CMD or Batch file:  echo ----------Task One Completed | timestamppipe.exe >> C:\Batch\Process_log.txt

Result in Process_log.txt file:
"2014-08-13 10:50:29"," ----------Task One Completed "

Download TimeStampPipe  (55K)


Sage TV System Message Alerter

This is not a console utility, but a windows program. It is only useful with the SageTV DVR software, and provides notifications of system messages (possible error conditions) generated by SageTV.  It will send an email when an error condition is reported in a Sage System Message. I wanted a simpler option for notification of HD-PVR failures than setting up the Sage Server system described elsewhere.

To install, copy the program to your \Program Files\SageTV\SageTV folder. Run it once manually to set the options; they will be saved in an INI file.
This program is intended to be run as a scheduled task. You can set it to check for errors as often as you want by the scheduling of the task. I have it check every 2 hours.

Fill in your ISP's SMTP server address, the subject you want on the notification emails, the from address you want on the emails, and the address the email is to be sent to. Auto Send Email should be checked except for testing purposes. To test email sending, you can type your own test text into the large memo field, and click the Send Email button. Any errors from the Email sending process will appear in the Status window at the bottom.

The "Send only on Priority" number is used to inhibit sending emails for messages about recording conflicts (priority 1). I set it to 3, which is the level of the "Failed to load video capture device" error.

When creating the scheduled task, add a /S flag to the command. The "Run" command in the task properties should look something like this: "C:\Program Files\SageTV\SageTV\SageSysMessage.exe" /S

When /S is present, the program will close immediately if no Sage System message is in the log file, and it will close after 5 seconds if the message has been displayed before.

October 19, 2009 Update:
The program has been updated to version 1.1. This adds the capability of SMTP authentication (but not encryption). If your ISP requires authentication, add the following lines to SageSysMessage.INI:
UseAuthentication=1
UseAltPort=0
UserName=nnnnnn
Password=pppppp
(where nnnnn is your email user name and pppppp is your password as required for authentication. If your SMTP port has to be 587 for authentication, then UseAltPort=1.)
If you get an error message saying that STARTTLS is required, then SSL encryption is required by the ISP. Gmail is one service that requires SSL. At this time, the program does not support encryption.

Update December 2009 (Version 1.2)

The program now has the ability to run an external program when a word or phrase is matched in the Sage System Message. At the bottom of the main window, check the box by "Run Ext Prog if phrase", and enter a word or words to match to the right. I use "Fail" which matches when there is a capture failure of the HD-PVR.
You will have to manually edit the SageSysMessage.ini file to configure the program or batch file that will be executed when the phrase matches. There is one section- [Settings]. The new entry should look like this (modified for your choice of program, of course):
ExtCommand=C:\Batch\reset_hd_pvr.cmd

Update January 2014 (Version 1.4)
Added ability to send SMS messages, at a different priority level than for email messages.

Update September 2018 (Version 1.8)
Minor updates and fixes

Download SageSysMessage

Screen shot:
Screen Shot




VTREE32

This is a WIN32 update to an old DOS program that generates a tree view of a drive, showing totals of bytes for folders and subfolders.  VTREE32 runs in a CMD window, and can be called from batch programs, and can be piped and redirected.
Download VTREE32  (55K)

Vtree32

VTREE V1.6 2015/09/06  Command Line Parameters:
/T    -  Only display Tree.
/132  -  Put screen in 132 column mode.
/Wnnn -  Set output width to nnn columns. (Only when output is redirected)
/H    -  This Help.
/N    -  no wait per page
/L    -  generate log file
/Vnn  -  deepest level to list


Up




* Legal disclaimer for the UNSUPPORTED software on this page

Note: I do NOT SUPPORT and have not performed compatibility testing with the free software on this page.

The programs are provided "AS IS." They may not function properly or at all, may not be compatible with your system, may contain viruses and/or may disrupt, damage or interfere with your use of your programs, computers or telecommunications facilities. I make no warranties of any kind whatsoever with respect to the programs. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY WARRANTY OF NON- INFRINGEMENT OR IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE HEREBY DISCLAIMED AND EXCLUDED TO THE EXTENT ALLOWED BY APPLICABLE LAW.

IN NO EVENT WILL I BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY ARISING OUT OF THE USE OF OR INABILITY TO USE THE PRODUCTS, EVEN IF I HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.