IBM Support

DB2CMD fails with 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Troubleshooting


Problem

Attempts to open a DB2 Command Window or DB2 Command Line Processor fail with: DB2CMD fails with 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Symptom

DB2CMD fails with 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Cause

The 8.3 short name for the directory where DB2 is installed does not exist, and the path contains spaces. If DB2 is installed in C:\Program Files\IBM\SQLLIB then the 8.3 short name 'C:\PROGRA~1' does not exist.

Environment

Windows

Diagnosing The Problem

DB2 is fully operational except DB2CMD fails with



    DB2CMD fails with 'C:\Program' is not recognized as an internal or external command, operable program or batch file.


DB2 is installed in a directory that contains spaces, like 'C:\Program Files\IBM\SQLLIB'.

Resolving The Problem

Windows support for 8.3 short names is normally enabled by default, and is controlled by this registry key:


    HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation

8.3 short names are enabled if it is set to 0 or 2.

Setting the above key to 0 will not create 8.3 short names for existing directories that were created when 8.3 short names was disabled. Unfortunately, if DB2 was installed when 8.3 short names was disabled, DB2 must be re-installed after 8.3 short names have been enabled in Windows.

Windows 7 and later versions include the 'fsutil' command that can be used to create the 8dot3 name once the registry key is set. For example,


    fsutil file setshortname "C:\Program Files" PROGRA~1

The use of the 'fsutil' command will avoid the requirement for re-installing DB2.

This problem can also be avoided by alternately installing DB2 in a directory that does not contain spaces.

NOTE: If fsutil command fails with:

Error: Access is denied

There is something holding onto "C:\Program Files. Using Microsoft Process Explorer one can check to see what is holding it. In this case, most likely, C:\Program Files may be held by the fonts installed for DB2.

To resolve the issue first uninstall the Fonts installed for DB2

:


To uninstall the fonts from DB2:
1) bring up control panel (run "control" in command prompt (admin))
   Go to Appearance and Personalization -> Fonts
   It should show "Preview, delete, or show and hide the fonts installed on your computer"
2) There are a few groups of fonts from IBM:
   a)Devanagari MT for IBM:
     Devanagari MT for IBM Bold
     Devanagari MT for IBM Regular
   b)Lucida Bright:
     Lucida Bright Demibold
     Lucida Bright Demibold Italic
     Lucida Bright Italic
     Lucida Bright Regular
   c)Lucida Sans:
     Lucida Sans Demibold
     Lucida Sans Regular
   d)Lucida Sans Typewriter:
     Lucida Sans TypeWriter Bold
     Lucida Sans Typewriter Regular
3) For each of the font files, right click and "delete"
   This will uninstall the particular fonts from the system.

This will take effect AFTER a reboot.  To confirm the fonts are uninstalled and SYSTEM process did not hold the handles, one can run Microsoft Process Explorer, "Find" with Handle or DLL,  substring "IBM". In this case as the font files are located under the
C:\Program Files files\IBM\sqllib\java\jdk\jre\lib\fonts
directory.  If the fonts are uninstalled, there should be no process with file handles opened against files under this directory.

Then boot into SAFE mode (with command prompt)
4) at command prompt run:
   fsutil file setshortname "C:\Program Files" Progra˜1
   This should be successful.
   Running in SAFE mode prevents DB2 services from starting.
   run dir /x on D:\ should show the shortname displayed.
5) Do a normal boot.
6) db2cmd should now work
7) To add back the deleted fonts, from Windows explorer, navigate to
   C:\Program Files\IBM\sqllib\java\jdk\jre\lib\fonts and select all fonts,    right click on the selected area and choose "Install".  This will install back the deleted fonts.

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Programming Interface - CLP","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.5;9.7;10.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21633795