CommandLine Tools
CommandLine Tools are a few tools I wrote for use in batch files.
Download
CommandLine Tools 1.0.5 (and Source Code)
CommandLine Send Mail
cmdsendmail is a tool that allows to send e-Mail from your Command Line. It reads it's settings from an Xml file, which means you can easily use it in a Batch File. For example, include it in your Backup scripts (or any other scheduled task) and have the script send an e-Mail to you whenever the backup task is finished, with the neccessary Logfiles attached.
CommandLine .net SVN Revision Replace
cmdnetsvnrev is a tool that replaces the AssemblyVersion and AssemblyFileVersion to include the SVN Revision Number.
It only changes the last Octet by default. For Example, if your AssemblyVersion is 1.0.8.0 and your SVN Repository is Revision 14, it will change your AssemblyVersion to 1.0.8.14. The same applies to AssemblyFileVersion.
This makes it a very useful tool for automated build scripts.
CommandLine Hash Generator
cmdhashgen is a Command Line Utility that can be used to generate various hashes for a given String or File.
Supported Hashes are CRC32, MD5, SHA-1, SHA-256, SHA-384 and SHA-512.
CommandLine InfoPath 2007 URN Changer
This tool allows changing the DateTime part of an URN in InfoPath Form 2007 Templates.
Requirements
These tools are based on Microsoft's .net Framework 2.0, which can be downloaded either on Windows Update or here. Note that Windows Vista, Windows 7 and Windows Server 2008 already include this Framework.
Change Log
The Change Log can be found on this page.
[...] Anyway, I’m back to having a working Development Environment and I’m working on the next version of my CommandLine Tools. [...]
[...] have just released Version 1.0.4 of my CommandLine Tools. Not much has changed, but the tools are now independent of the CSharpOptParse.dll as outlined in [...]
Y:\>H:\Down\Tools4Nt\cmdtools-bin-104\cmdhashgen\cmdhashgen.exe c:\boot.ini
CommandLine Hash Generator 1.0.4 (r133) · http://www.Stum.de
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Hashing [File] "c:\boot.ini"
Unhandled Exception: System.UnauthorizedAccessException: Access to the path 'c:\boot.ini' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATT
RIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at stumde.cmdtools.cmdhashgen.Program.GetHash(String Input, Boolean IsInputString, HashAlgorithm hasher)
at stumde.cmdtools.cmdhashgen.Program.GetHashOutput(String HashName, HashAlgorithm Hasher, String HashInput, Boolean IsInputString, Boolean BareDisplay)
at stumde.cmdtools.cmdhashgen.Program.Main(String[] args)
Thanks, going to catch UnauthorizedAccessException's in the next version. Basically it says that you can't access c:\boot.ini, presumably because it's a system file and/or you're not an Administrator on the machine.
cmdhash: can it include CRC32 in the next version (apart from the other requested or anyway planned hash types)?
I know, it is not an "new and secure" hash function.
This hash is quite often used in the filenames of file collections (anime video mostly), it would reduce my number of tools.
The only usable cmdline one on the net is this one:
http://www34.brinkster.com/dizzyk/crc32.asp
greets, Jou
Thanks for the suggestion, I'll have a look at it. I'm expecting a new version possibly in early June.
Currently I use netcat/nc.exe to email log files around, but various virus scanners hate that tool and call it "possible riskware" and the like, and I start using cmdsendmail as replacement.
For many of the thing I send around it is better to have the logfile in the body and not as attachment.
Can cmdsendmail include an text-only file inline in the body?
Or is it possible to have a tags like those:
overview of backup directory:
or:
overview of backup directory:
or:
overview of backup directory:
greetings again, Jou
Oh, this form eats all xml/html codes !
examples (with brackets as replacement):
(body html="false")overview of backup directory
(attachment)(![CDATA[output-of-dir.txt]])(/attachment)
(include)(![CDATA[output-of-dir.txt]])(/include)
(/body)
Jou
Thanks for the suggestion. Embedding (text) files indeed makes sense. I've written it down for 1.0.5.
[...] CommandLine Tools [...]
Hallo Michael
Aufgrund Deines Namens gehe ich mal von deutscher Sprache aus. Ansonsten werde ich das schnell merken.
Erstmal Danke für Dein cmdhashgen.
Ich biete für meine eigenen Freewaretools MD5 an und will das noch um SHA1 erweitern. Deshalb bin ich auf der Suche nach einem CMD/Batch Tool um SHA1 Prüfsummen erstellen zu können. Diese Prüfsummen werden bei mir während des Produktionsablaufes automatisch erstellt und zusammen mit den eigentlichen Dateien auf die Homepage geladen. Dann erstellt der Server seinerseits ebenfalls eine MD5 Prüfsumme und vergleicht diese mit der hochgeladenen. So sehe ich und auch die User sofort, ob die hochgeladene Datei exakt dem Original entspricht. Das gleiche biete ich auch nochmal als PGP Sig an. Ich habe für MD5 eig. schon ein CMD Tool, aber Dein cmdhashgen könnte gleiche beides. Aber: Dein Tool erzeugt keine standardkonforme Ausgabe und andere Tools erkennen deshalb keine gültige Prüfsumme bzw. quitieren den Ablauf wegen ungültigem Dateiaufbau. Diese Tools wären in meinem Fall Total Commander und md5sum.exe. Könntest Du den Schalter /b noch überarbeiten damit man direkt Prüfsummendateien erstellen kann, die auch dem Standard entsprechen?
Was ich meine:
63c91190ae748ed40aa3834588d23591 cmdhashgen.exe MD5
Zuersteinmal darf MD5 nicht am Ende einer Dateizeile stehen. Daran verschlucken sich bereits andere MD5 Tools. Dann sollte vor jeder Datei ein Stern stehen. Warum das so ist, habe noch nicht herausgefunden, wird aber von allen anderen MD5 Tools so erzeugt.
Korrekt wäre also folgende Ausgabe bei Verwendung mit /b:
63c91190ae748ed40aa3834588d23591 *cmdhashgen.exe
Eig. wollte ich Dir eine E-Mail schreiben, aber ich finde hier nirgends ein Impressum, oder bin ich blind?
Luke
Hi,
danke für die Anmerkungen. Ich werde mir mal anschauen was md5sum (ist ja quasi eh das standardtool für MD5) produziert.
hi,
i try cmsendmail but i got
"ERROR: There is a problem with the server plus.smtp.mail.yahoo.com!
Message: Impossible de lire les données de la connexion de transport : net_io_connectionclosed."
i m on vista (french) and using plus.smtp.mail.yahoo.com (Using Auth: yes)
thanks in advance
Thanks for the report! Looking at Yahoo Plus Mail, It looks like it's running on Port 465 rather than 21, but more importantly, it seems like it requires SSL. Changing the port is easy through the .xml file, but I don't think that cmdsendmail supports SSL. I'll have a look for the next version.
cmdsendmail seems to do some wrong base64 encoding, even if it is not wanted (i.e. embedd-text file).
------
Trying to send Mail...
ERROR: There is a problem with the server mail.lf.net!
Message: Ungültige Länge für einen Base-64-Zeichenarray.
Finished execution on 2009-08-21 01:53:29
------
I would like to send you the .xml file which makes this nicely reproducable on 2003 and Vista64, but no email on this site (for obvious reasons), so send me one and I send you the problem file(s).
That's weird. Can you send it to bugs{at}stum.de ? Thanks!
Hi- Does CmdSendMail support TLS authentication to the SMTP server?
cmdhashgen question:
/r (/recursive) and wildcard support planned?
Hi,
TLS or SSL is not supported as of now. I am currently in the middle of a move which will take until well into November, but I'll take the source code with me. Recursive/Wildcard support sounds like a good idea. I'll try to find some time to look into TLS/SSL support, as I have to rewrite quite a bit of things anyway because of the base64 issue (which looks like a bug in the .net Framework)
good software
Hallo,
wie kann ich beim Versenden einer E-Mail Dateien mit sich ändernden Namen anhängen (Dateien die jeden Tag einen Neuen Zeit und Tagesstempel bekommen)?:
Bsp.: Dateiname_Tagesstempel_Zeitstempel.txt.
Ist es auch möglich die Umgebungsvariable %COMPUTERNAME% im Subject oder Body zu verwenden?
Hallo,
Umgebungsvariablen oder andere Dynamische Zeichen sind in der derzeitigen Version nicht moeglich. Ich schaue mir das evtl. ind en naechsten Wochen nochmal an weil ich selber Verwendung dafuer hatte eine Umgebungsvariable zu verwenden. Damit kann man dann quasi alles dynamisieren wie man will weil man ja in einer Batch arbeiten kann.
Strings, files, . . . sha512 . . .
Yours is the best command line hash utility by far.
Thanks.