Solved: CMD – Comma And Apostrophe In File Name

working with com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi,armeabi-v7a,mips,x86)(nodpi),
the %1, %~1 tries to parse a list of arguments
and will give you: com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi.

%~s1 will fail too.

A workaround:
gulp the entire thing,
and re-parse content into short-path for easier usage.

@echo off
::                              enable Unicode support for path/file-name.
chcp 65001 2>nul >nul

::                              single arg - workaround weird file-name.
set "ARG=%*"
for /f %%a in ("%ARG%") do ( set 'ARG=%%~fsa' )

pure CMD:
the code above will generate a fully-qualified,
short (8.3-DOS like) path.

if you do need to pass more than one argument,
this is not the solution for you.

– – – – – –

The above code does not always works
since it will turn off any tries to parse single argument from the string,

Passing %* to other programs as an argument will always work,
but built-in handling of file-names, with apostrophes will still fail,
due to “by design” issues in CMD (wrapping phrases uses apostrophes..)

instead, try passing %* to GetShortPathName.exe from,
with the additional processing allowing empty-strings/empty-character (\0) and Windows API.
it will return a short 8.3 version of the path (relative or full),
if you want a fully qualified path try using GetFullPathName.exe from

You can use your choice of implementations, that simple one is written in VB6.

Java And UTF-8

When running a java application,
make sure to use -Dfile.encoding=UTF8,
for an 8-bit Unicode-support.

Interaction with standard input/output
requires setting the output’s code-page too.

For Windows run: chcp 65001 before you execute java.

For Unix/Linux: export LC_ALL="en_US.UTF-8".

Here is an example of a Windows batch-file named apktool.cmd,
that wraps around a jar-program named apktool.jar:

@echo off
chcp 65001 2>nul >nul
call java.exe "-d64 -Xverify:none -Duser.language=en -Dfile.encoding=UTF8" -jar "%~dp0\apktool.jar" %*

and here is why it is important to specify the output’s encoding:

Reader classes are now covered, for Writer classes make sure to explicit use UTF-8.
prefer using OutputStreamWriter (instead of FileWriter which does not support explicit charset):

BufferedWriter out = new BufferedWriter(
                       new OutputStreamWriter(
                         new FileOutputStream(path)

Some swear by explicit providing and additional reader/writer set,
so here is that too:

 OutputStreamWriter char_output = new OutputStreamWriter(
     new FileOutputStream("some_output.utf8"),

 InputStreamReader char_input = new InputStreamReader(
     new FileInputStream("some_input.utf8"),

which can be specified to handle input-error, which is sometime useful..

CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("jedis.txt"),encoder));

Everything here is considered quite-safe to use,
since 8-bit Unicode (UTF-8) will still allow a fallback to displaying
characters out-of US-ASCII (for example) without the need for adding an
extra BOM bits, unlike UTF-16…


CMD NewLine Character

set NEWLINE=^& echo.
echo hello%NEWLINE%world

And You’ll get


Manually Removing Fonts From Windows, And Refreshing The Windows Font-Cache Storage File

*Close/save any opened documents and programs since this process will require a restart at some point,
plus programs/documents may attach hooks, locking the font-folder and its content.

First, stop the services FontCache3.0.0.0 (Windows Presentation Foundation Font Cache and FontCache (Windows Font Cache Service), and set the their startup-type to “disabled” (just for those few moments…)

Stopping those services, will allow you an easier access to the C:\Windows\Fonts folder,
without those processes constantly accessing the fonts-folder.

next use task-manager to stop explorer.exe processes, which will unhook most of the hooks set to the C:\Windows\Fonts folder (including the files inside it..)

Use unlocker to unlock any of the remaining hooks,
and any way of browsing for files such as FAR-commander or even Locate32, to help you delete any of the font files you want.

It is best to make a backup-copy of the entire folder, including all of the files inside,
just in-case.

Use CCleaner to automatically clean-up any registry-entries for the deleted-font files,

We’re almost done, and now it is time to delete the static-cache files for the font-folder,
so new ones will be created for the new folder-content.

Remove (or rename their extensions to .old) both FNTCACHE.DAT and StaticCache.dat which you’ll find under C:\Windows\System32\ and C:\Windows\SysWOW64\.

*Generating the new cache-files will be done automatically the next time the cache-services will start-up,
but we’ll let them start automatically after the next PC-restart.

Before restarting your PC,
switch the startup-type of both FontCache3.0.0.0 and FontCache to “automatic”,
without actually restarting them by yourself.

Quickly press [WINDOWS]+[R], to open-up the “run” dialog-box,
type restart -f -r -t 00 and press [ENTER].

The next time the computer will be up,
after you’ll log-into your account, the new cache-files will be created.

You may even want to refresh the icon-cache for your desktop icons and such,
by running the following command: ie4uinit.exe -ClearIconCache (you’ll have to wait few moments for it to finish). No need to restart afterwards.

The entire process takes few moments but it will speed up your Windows-PC,
especially if you’ll end-up deleting a lot of unneeded font-files.

Here is a way of doing the same process, automatically,
and much faster…

Continue reading

Aria2C Batch File For Quick Download

Copy to following CMD batch-file content into a new file,
and name it aria2download.cmd.

Place the file in the same folder as your aria2c.exe,
make sure it is your system-PATH,

and you can now enter aria2download "http..your-url..."
for a quick file-download to the current folder you are in.

All the important-switches are already set, such as maximum split value, and maximum connections per-server for ultra-fast download and an extra permissive-SSL to allow you to download from secure-servers without certificate verifying and a browser-like useragent and referrer value to generate a compatible download session with servers that often will block download-managers. You can easily personalise the batch-file to include an additional headers, authentications, etc…

Continue reading

Adding ‘Noto Mono’, ‘Courier New’, ‘Droid Sans Mono’, ‘Roboto Mono’, ‘Ubuntu Mono’ To Windows’ CMD

Just make sure you have those (you can google-search them or look for them at, the ‘Courier New’ font-face should be already installed in your Windows).

feel free to edit/replace/add more,
make sure the fonts are mono-type, use ‘000…00’ as name.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont]
"000"="Noto Mono"
"0000"="Courier New"
"00000"="Droid Sans Mono"
"000000"="Roboto Mono"
"0000000"="Ubuntu Mono"

If you don’t know of name of the font (it should be exactly right!),
open any program that does some sort of font selection, and allows copy&paste, such as Microsoft-Word or even Notepad2/Notepad++.

Notepad2 has a “default font” selection, which I’m not going to actually change, but just use it to browse-for font-names.

the standard control-panel, used by most (simple) does also allow easy copy&paste.

ExifTool – Ultimate Batch To Remove All Tags, From Infinite List Of Files, With Verbose Status And Progress Report

ExifTool is a free and open-source software program for reading, writing, and manipulating image, audio, video, and PDF metadata. It is platform independent, available as both a Perl library (Image::ExifTool) and command-line application. ExifTool is commonly incorporated into different types of digital workflows and supports many types of metadata including Exif, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3, as well as the manufacturer-specific metadata formats of many digital cameras.

The following example is a batch for Windows operation-system, but it can be easily migrated to any other supported OS, to use it, just mark a bunch of files (any amount! it does not limited to usual batch-queue-limit of 9) and drag&drop them over the batch-file.

Plus it will work on any file, naturally file-types that are not supported by the ExifTool will be ignored (skipped), so feel free to just use [CTRL]+[A] to select all the files without pin-point-select just the ones you need.. or unsure if they will be supported, if it will, it will.. and if it won’t, it won’t.. :]


@echo off
::has argument ?
if ["%~1"]==[""] (
  echo done.
  goto END;
::argument exist ?
if not exist %~s1 (
  echo not exist
  goto NEXT;
::file exist ?
echo exist
if exist %~s1\NUL (
  echo is a directory
  goto NEXT;
echo is a file

set FILE_INPUT="%~s1"
set FILE_OUTPUT="%~d1%~p1%~n1_fixed%~x1"

call exiftool -progress -verbose -ignoreMinorErrors -XMPToolkit="" -all="" -trailer:all="" "%FILE_INPUT%"

goto LOOP


CMD Snippet – Selective Executing From Either Windows System32 Or SysWOW64 Folders With Easy And Simple GOTO-State-Machine

A Bit Overkill of verifying what version of EXE to use (x32/x64), with error handling.
I use `ie4uinit.exe -ClearIconCache || ie4uinit.exe -show` as an example for an execute that exist in both-folders.
This is just a dictionary code, you can make it more efficient by storing the files and paths using `SET`, and even skip the x32 check or put the x32 path in a variable and optinally overwrite it, then executing the file blindly.
P.s just f.y.i. – executing `ie4uinit` from either x32 or x64 does not really makes a difference (this is just an example..)

The %WINDIR%\SysWOW64\NUL is a small trick to see if the path is a folder.

@echo off
:: A Bit Overkill of verifying what version of EXE to use (x32/x64), with error handling.
:: I use `ie4uinit.exe -ClearIconCache || ie4uinit.exe -show` as an example for an execute that exist in both-folders.
:: This is just a dictionary code, you can make it more efficient by storing the files and paths using `SET`, and even skip the x32 check or put the x32 path in a variable and optinally overwrite it, then executing the file blindly.
:: P.s just f.y.i. - executing `ie4uinit` from either x32 or x64 does not really makes a difference (this is just an example..)

if exist %WINDIR%\SysWOW64\NUL (
  if exist %WINDIR%\SysWOW64\ie4uinit.exe (
    goto X64;
  goto ERR;
if exist %WINDIR%\System32\NUL (
  if exist %WINDIR%\System32\ie4uinit.exe (
    goto X32;
  goto ERR;

goto EXIT
::--------------------------------------------------- this part will be-reached only by directly passing through `GOTO`-directive.
%WINDIR%\SysWOW64\ie4uinit.exe -ClearIconCache
goto EXIT

%WINDIR%\System32\ie4uinit.exe -ClearIconCache
goto EXIT

echo ERROR.
goto EXIT


Available also here:

NodeJS Nightly

NodeJS x86, version 8 Nightly (latest)
– Including the latest docs
– Including the complete source-code – required for IntelliJ (under lib folder)
– Including latest node.lib (Visual-Studio integration)
– Including latest node.pdb (Microsoft Program DataBase, debugging information)

– Super compressed 290MB – to 36MB.

Download (many mirrors)

Password: 1

Solved: ThinApp Registry Export

Say you want to convert VMWare’s ThinApp (formerly known as Thinstall) Registry,
From the sanbox-virtual format (those text files in your capture/project-name folder) To something a human can be easily read, say, a windows registry file.

Why? well.. maybe you’ve just captured a setup process in-order to check what has been changed on your operation-system.

A really common reason to use ThinApp without actually building anything at the end, at least among the VM-savvy engineers is for the sake of tracking the changes to the operation-system, in hope of simplifying installations, in cases all you may need is a pair of exe-and-reg files and no need for an overkill of sandboxing an entire application + virtualapp-engine.
ThinApp does a very good job of capturing even the deepest registry changes (including those of permission limitation or ones which does not “really exist”, such as soft symbolic-linked keys for example under HKEY_USERS (which are common enough).

Another way of comparing registry changes including dumping the entire registry (before and after..) and comparing the the .REG files using a program such as BeyondCompare.

A similar method but somehow slightly easier is the usage of Registry-Workshop, and the “before” and “after” snapshots feature, following the built-in compare-engine which is pretty much a nice wrap around the same thing (above) except using the program’s internal-compare engine which also allows to jump-into the inspected values, sync changes, etc…


I’ve captured a nice little freeware called foxit PDF
and got the familiar folder structure (before building anything!)


If you’ll have a look (just a look, don’t worry..)
inside the build.bat batch-file,
You’ll see part of the command we’ll going to use, which is actually part of creating the virtual-sandbox,
in-particularity- the REGISTRY part:


After the hint, it is time for the solution walk-through:

  1. Under your ThinApp folder (same level where you’ll find the Setup Capture.exe file create a new folder, named reg_convert.
  2. Under reg_convert create two folder named in and out
  3. Under in folder, copy the Package.ini from your captured-package,
    or use this generic, minimal Package.ini

    you only need the part related to setup-capture, mostly the versioning of the capturing engine of ThinApp, and the code-page [language] of 1033 [English] might be useful in-case you have registry keys with foreign-characters, which in this case you might want to have a look at the values of one of your original captured Package.ini files, or Google it.. 1037 is Hebrew :]

    ;-------- Parameters used only during Setup Capture  ----------
    AccessDeniedMsg=You are not currently authorized to run this application. Please contact your administrator.
    CaptureOSCSDVersion=Service Pack 3


  4. Still under the in folder, you should now copy (just) the registry files (.TXT) from your captured project.

    You do not have to copy them all, and you are well encouraged to make them as small and lite as possible by removing values that are not needed. The smaller and fewer they’ll be, the faster the entire process will be completed.

    For example I’ll going to remove the following “keys/values/data” since they are not needed or even related to the package itself, even more than that, those can collide with the operation-system’s more recent-values (in-case I’ll be building the project later..)

  5. At this point, we will generate a virtual-sandbox holding just the registry values (no files), using the vregtool.exe command.

    1. open up CMD and navigate to where you have your vregtool.exe
      (same place you’ll have reg_convert).
      cd c:\.......\ThinApp\
    2. run vregtool.exe reg_convert\out\reg.tvr ImportDir reg_convert\in\,
      You may ignore warnings, or remove any extra-empty lines at the bottom of the txt files,
      It will take few seconds, and you’ll find the tvr file under the out folder.
      1. Almost done, we will, now, extract the actual registry key (in the standard windows format) from the virtual-sandbox, exporting it to the same out folder.

        run:vregtool.exe reg_convert\out\reg.tvr ExportReg reg_convert\out\registry.reg
        You’ll find your result file under the out folder as well as the old tvr file.

      2. Done.

        naturally a cleanup will be required in-order to use the same method of converting txttvrreg,
        remove the txt files under in folder, keep Package.ini file there to be used the next time.
        you can safely remove the entire content of the out folder (the reg.tvr, and once you’ll be done with it- the registry.reg file).

        Naturally a batch file can quite easily be generated,
        You can make one to drag&drop the entire captured-folder, allowing automated copy, generating the copying back the result to your captured-project, in same place as the txt files, to keep things organised by project. :)

      Hope it helps ! :]

      Happy engineering day :]]

CMD Ninja – Relative To Fully Qualified Path And Other File Properties Without Directing Relative Path To Another CMD-File As An Argument

Given the following directory-tree

I want to get some information on apktool_2.0.2.jar
for example fully-qualified short (old dos 8.3 format that is compatible with old Java argument’ing) path,

here is a snippet containing it,
this ‘_’ prefix is advisable, the double ‘%’ is to escape the loop’s variable, the ‘~’ is to strip any \’ \” wrapping chars around the path (best practice, always use it), the reason ‘_drive’ phrase has (also) ‘s’ in it is to make the result more letter-case consistent (the 8.3 format uses Upper-Case while if you’ll run CMD console and browse or change-dir using a Lower-Case drive letter it will be embodied in the result).

@echo off
set relative=.\apktool_2.0.2.jar

for /f %%a in ("%relative%")do (set "_full=%%~fa"     )
for /f %%a in ("%relative%")do (set "_full83=%%~fsa"  )
for /f %%a in ("%relative%")do (set "_drive=%%~dsa"   )
for /f %%a in ("%relative%")do (set "_path=%%~pa"     )
for /f %%a in ("%relative%")do (set "_path83=%%~psa"  )
for /f %%a in ("%relative%")do (set "_name=%%~na"     )
for /f %%a in ("%relative%")do (set "_name83=%%~nsa"  )
for /f %%a in ("%relative%")do (set "_ext=%%~xa"      )
for /f %%a in ("%relative%")do (set "_ext83=%%~xsa"   )
for /f %%a in ("%relative%")do (set "_att=%%~aa"      )
for /f %%a in ("%relative%")do (set "_time=%%~ta"     )
for /f %%a in ("%relative%")do (set "_size=%%~za"     )

echo %_full%
echo %_full83%
echo %_drive%
echo %_path%
echo %_path83%
echo %_name%
echo %_name83%
echo %_ext%
echo %_ext83%
echo %_att%
echo %_time%
echo %_size%

::  relative  < ->  .\apktool_2.0.2.jar                        ::
::  _full     < ->  D:\DOS\android\bin\apktool_2.0.2.jar       ::
::  _full83   < ->  D:\DOS\android\bin\APKTOO~1.JAR            ::
::  _drive    < ->  D:                                         ::
::  _path     < ->  \DOS\android\bin\                          ::
::  _path83   < ->  \DOS\android\bin\                          ::
::  _name     < ->  apktool_2.0.2                              ::
::  _name83   < ->  APKTOO~1                                   ::
::  _ext      < ->  .jar                                       ::
::  _ext83    < ->  .JAR                                       ::
::  _att      < ->  --a------                                  ::
::  _time     < ->  10/14/2015 02:06 PM                        ::
::  _size     < ->  6329931                                    ::

CMD Ninja – Unlimited Arguments Processing, Identifying If Exist In File-System, Identifying If File Or Directory

@echo off

      ::-------------------------- has argument ?
      if ["%~1"]==[""] (
        echo done.
        goto end
      ::-------------------------- argument exist ?
      if not exist %~s1 (
        echo not exist
      ) else (
        echo exist
        if exist %~s1\NUL (
          echo is a directory
        ) else (
          echo is a file
      goto loop


save it as identifier.cmd
it can identify an unlimited arguments (normally you are limited to %1%9), just remember to wrap the arguments with inverted-commas, or use 8.3 naming, or drag&drop them over (it automatically does either of above).

this allows you to run the following commands:
identifier.cmd c:\windows
and to get

is a directory

identifier.cmd "c:\Program Files (x86)\Microsoft Office\OFFICE11\WINWORD.EXE"
and to get

is a file

and multiple arguments (of course this is the whole-deal..)
identifier.cmd c:\windows\system32 c:\hiberfil.sys "c:\pagefile.sys" hello-world
and to get

is a directory
is a file
is a file
not exist

naturally it can be a lot more complex,
but nice examples should be simple and minimal.

also posted at StackOverflow:

CMD UTF-8 By Default

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor]
"Autorun"="chcp 65001"


note that PYTHON 2.7* is having problems after this modification,
so I’ve reverted this reg-hack…