Show portable version informations embedded in binary files under windows, linux and macintosh, on the command line or in batch files.
Embed a simple string version info in your programs without the need
for non portable manifest files.
sfk version filenamesfk ver -own
print version of a binary file, or of sfk itself.
this function can be used:
1. with binary files containing a portable version string:
$version:name=sfk,type=base,os=windows,vernum=1.5.1,fix=0,title=Swiss File Knife,date=Aug 2 2008,info=major rework$\0
2. with windows binaries, where only file version and bitsize
are extracted, and shown with the file modification time.
if a product version is found that differs from the file
version it is shown in the info field.
version string fields:
 *name short name, usually similar to the executable name
 type the type of edition, e.g. base or extended
 *os operating system, e.g. windows, linux-lib6, linux-lib5
 *vernum version number, any number of values separated by dots
 fix fix level, e.g. a revision or service pack number
 *title long, descriptive name, as printed in a help text
 *date release or compile date
 info additional infos or remarks, free text string
fields marked with "*" are mandatory for a valid version string.
the other fields can be left out, or be empty like ",fix=,".
if found, contents are printed TAB-separated, after the filename,
therefore the  numbers given above are output column numbers,
not the location in the input string (which is random anyway).
-num[ber] just print the full version number, combining
vernum and fix to a dotted string.
cannot be used with -own.
-verbose tells a warning if file(s) contain no version.
-win[dows] compact display of file, os, version and filetime
which is all that's shown for windows binaries.
aliasessfk winver - same as sfk ver -win to primarily list
windows file version infos.
see alsosfk require - check if a required version is used.
web referencehttp://stahlworks.com/sfk-versionexamplessfk ver dview.exe
print the version of a Depeche View executable.
sfk ver -own
print sfk's version.
print sfk's version (quickest).
sfk ver . .exe
show the version of all .exe files within
the current folder and all sub folders.
sfk ver -nosub . .exe +filt -ssep "\t" -sform "$-20.20col1\t$col5"
search all .exe files of the current dir for versions,
reformatting the output, with a 20 chars filename limit.
version embedding example for C/C++ programsAdd to your source code:
#define SOFTWARE_VERSION 101 // meaning 1.01
#define OS_SHORT_NAME "linux" // or "windows", "mac"
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define SOFTWARE_VERTEXT TOSTRING(SOFTWARE_VERSION)
static const char *pGlblVersionText =
" $version:name=footool,vernum=" SOFTWARE_VERTEXT ","
"title=The Foo Bar Tool,"
"os=" OS_SHORT_NAME ","
"date=" __DATE__ " " __TIME__ "$\0";
// NOTE: this dummy operation is required with some compilers
// to keep pGlblVersionText from being stripped by the linker,
// as it isn't used anywhere within the code.
// ... (print actual help text)
After compile, extract version like:
sfk version footool.exe
footool.exe footool linux 101 The Foo Bar Tool Apr 20 2013 08:58:40