Archive
HowTo: install multiple Corel Painter brushpacks silently
I got a nice expression software charity bundle with Corel Painter 2020 (current version is 2021) and a bunch of brushes in it and then noticed that the brush packs where available for download as separate installers than the Painter software.
So I launched one of the brush pack installers from the command-line (can give CMD and press enter at the address bar of the file explorer window to open command-line in the current folder) with a /? parameter to see its syntax:
e:\brushpack_abstract_windows.exe /?
Then I created a batch file to loop over all the brush_* installer files using the following commands in the console (press ENTER after each one). The for loop executes each brush pack installer from the same folder passing parameters for silent mode (/S /v/qn), as instructed by the dialog above:
copy con PainterInstallBrushes.bat
@for %%f in (brushpack_*) do %%f /S /v/qn
^Z
The last one (^Z) means Press CTRL+Z (then press ENTER for that line too). It signifies the end-of-file / input. We were inputing/copying keystrokes from the console (CON) into the file PainterInstallBrushes.bat (note that if the file exists you’re asked to overwrite it as soon as you copy the 1st line into it, but you still have to press CTRL+Z and ENTER to end input).
To avoid having to press Yes at repeated security dialogs (due to User Access Control [UAC] being activated), I opened an administrator command-prompt (can give CMD at Windows search and right click the found cmd.exe and select to open it as administrator), then executed the batch file (E: goes to drive E, CD \Corel.com goes to Corel.com folder under E: drive root)
c:\windows\system32> e:
e:\somefolder> cd \Corel.com
e:\Corel.com> PainterInstallBrushes.bate:\Corel.com>PainterInstallBrushes.bat
e:\Corel.com>brushpack_abstract_windows.exe /S /v/qn
e:\Corel.com>brushpack_alcoholink_windows.exe /S /v/qn
e:\Corel.com>brushpack_bristly_windows.exe /S /v/qn
e:\Corel.com>brushpack_bubbles_windows.exe /S /v/qn
e:\Corel.com>brushpack_drytexture_windows.exe /S /v/qn
e:\Corel.com>brushpack_feather_windows.exe /S /v/qn
e:\Corel.com>brushpack_fireworks_windows.exe /S /v/qn
e:\Corel.com>brushpack_gesturalillustration_windows.exe /S /v/qn
e:\Corel.com>brushpack_mangaii_windows.exe /S /v/qn
e:\Corel.com>brushpack_michellewebbmasterpack_windows.exe /S /v/qn
e:\Corel.com>brushpack_nature_windows.exe /S /v/qn
e:\Corel.com>brushpack_perfectpets_windows.exe /S /v/qn
e:\Corel.com>brushpack_popart_windows.exe /S /v/qn
e:\Corel.com>brushpack_rain_windows.exe /S /v/qn
e:\Corel.com>brushpack_rake_windows.exe /S /v/qn
e:\Corel.com>brushpack_rustandpatina_windows.exe /S /v/qn
e:\Corel.com>brushpack_scrape_windows.exe /S /v/qn
e:\Corel.com>brushpack_stipple_windows.exe /S /v/qn
e:\Corel.com>brushpack_suminagashi_windows.exe /S /v/qn
e:\Corel.com>brushpack_sunnyrays_windows.exe /S /v/qn
An alternative way to using the command-line would have been to create the batch (.bat) file with a text editor in the same folder as the brush pack installers, then right click it and select to run it as an administrator from the popup menu.
Redirecting output of batch file from the inside
Calling a label in a batch file is useful to redirect (for logging) the output of the batch file to a file from inside that same batch file, without needing to author a separate batch file to do the redirect of standard output.
@echo off
call :process > update_cxml.log
goto :EOF:process
…
(Revised previous version of this post)
HowTo: Check MSDN Subscriber downloads for tampering via SHA-1 key
Supposing you have an MSDN Subscription, you could download say SQL Server 2012 Standard Edition (x86 and x64) – DVD (English) from the following URL:
http://msdn.microsoft.com/en-us/subscriptions/downloads/hh442898.aspx#FileId=48810
Suppose you do so and you keep that .ISO file (a CD/DVD image that you can burn to a disk using Windows 7 or Active@ ISO Burner tool, or mount as a virtual disk with Daemon Tools or unpack with WinRAR etc.).
Later on before installing it you’d like to know if it has been tampered in between by some virus, or if it was tampered by some man-in-the-middle attack during the download process.
Luckily, the MSDN subscriber downloads page is accessible without even signing in with your Microsoft account credentials and has a Details link for each download item that shows an SHA-1 hash key for the file (very handy if you don’t want to use the company’s credentials on a developer machine, but just want to copy-paste the SHA-1 key from there to check it against the file you have at hand).
Speaking of SHA-1, it would be nice if Microsoft also displayed an MD5 key there too for cross-checking both of them, or even a SHA-3 key in the future, that is supposed to be more (cryptographically) secure.
To check the file against the SHA-1 key, you can use the Microsoft File Checksum Integrity Verifier (FCIV) tool, a free command line utility that computes MD5 or SHA1 cryptographic hashes for files: http://www.microsoft.com/en-us/download/details.aspx?id=11533
FCIV installer just unpacks an fciv.exe and a ReadMe.txt file. The command-line parameters for fciv.exe are displayed if you run it from a command-line (cmd.exe or command.exe in XP) window:
//
// File Checksum Integrity Verifier version 2.05.
//
Missing flag: -xmlUsage: fciv.exe [Commands] <Options>
Commands: ( Default -add )
-add <file | dir> : Compute hash and send to output (default screen).
dir options:
-r : recursive.
-type : ex: -type *.exe.
-exc file: list of directories that should not be computed.
-wp : Without full path name. ( Default store full path)
-bp : specify base path to remove from full path name-list : List entries in the database.
-v : Verify hashes.
: Option: -bp basepath.-? -h -help : Extended Help.
Options:
-md5 | -sha1 | -both : Specify hashtype, default md5.
-xml db : Specify database format and name.To display the MD5 hash of a file, type fciv.exe filename
Based on those, you can create an fciv.bat file, where you have something like the following:
c:\users\myself\desktop\admin\fciv.exe -both %*
@pause
This batch file (fciv.bat) runs fciv.exe (assuming it is at path c:\users\myself\desktop\admin above, change this appropriately), passing it –both parameter to generate both SHA-1 and MD5 keys (could have used –sha1 instead for more speed, since MSDN doesn’t give MD5 key for files).
It uses %* to pass all command-line parameters of the batch file to the executable fciv.exe file. This means you can then drag-drop any file onto the fciv.bat at Windows Explorer and it will run fciv.exe on it, telling it to generate both MD5 and SHA-1 keys (shown in a tabular form at the output).
Before exiting, the batch file executes pause (the @ prefix means to not display the command itself on the console – could have also used an @echo off command at the start of the batch file but want to show the fciv.exe command path being executed for troubleshooting) instead of closing the console window immediately as would happen if you drag-dropped a file on fciv.exe itself). Pressing space after you read the hash keys (can also copy-paste them from the console right-clicking it and selecting Mark command, then drag to select and press SPACE key to copy), will then close the console.
Do note that FCIV also can take other parameters, to add calculated keys to a simple XML file (serving as a database) which it can use later on to check multiple files for tampering when you tell it to.
Windows 7 Command Line Help mistake for IF command
If you type
help IF
at the Windows 7 command-line (can launch this by searching at Windows Start menu search box for “Command” or by typing cmd there and pressing ENTER), you get in one of the help pages printed out for the batch files’ IF command:
%ERRORLEVEL% will expand into a string representation of
the current value of ERRORLEVEL, provided that there is not already
an environment variable with the name ERRORLEVEL, in which case you
will get its value instead. After running a program, the following
illustrates ERRORLEVEL use:goto answer%ERRORLEVEL%
:answer0
echo Program had return code 0
:answer1
echo Program had return code 1
If a program you launched from the batch file returns error code 0 (meaning usually no error), then you jump to label (using “goto” command) answer%ERRORLEVEL% that is answer0 (labels are prefixed with : in DOS/Windows batch files) and it prints out (using echo command) on the console “Program had return code 0”.
Fine till here, but then it will proceed to next commands (the block labeled :answer1) and also print out “Program had return code 1”. Obviously the correct example should be:
goto answer%ERRORLEVEL%
:answer0
echo Program had return code 0
goto finish
:answer1
echo Program had return code 1
:finish
Could also have a goto finish after the last echo, but its needless since we don’t have :answer2 etc. labels after that and proceeds to finish by itself anyway.
Thinking of this example again, it’s a pretty silly one since one could do instead:
echo Program had return code %ERRORLEVEL%
BTW, to output an empty line to the console you can use echo:
And speaking of batch file tips, you can use :: for comment lines instead of REM command.