PTC MKS Toolkit Knowledge Base

Section:IO
Product:MKS Toolkit (All)
Version:
OS:All
Keywords:script, output
Category:Utilities/Knowledge Base


How can I display the output from running a script with a .ksh extension?


When the KornShell attempts to open a file it will use the extension to determine how this should be done. The KornShell has builtin behavior for opening files ending in .ksh, .exe, .com, .bat, or .cmd. As an example, any file ending in .ksh will be run as a shell script with output to the current window. For any other extension, Toolkit 6.1 and newer KornShells will search the registry for an associated application to open it with. The application in the registry for .ksh is the Toolkit KornShell. The command in the registry to start KornShell scripts causes them to be run in a new minimized, hidden shell window (wstart -Nm sh -H -- %1 %*). This is why you do not see any output from a script named with a .ksh extension. To change this behavior you can remove or modify the .ksh entry in the registry or rename the file extension to .sh. If the KornShell can not find a registry entry for a given extension, it will try to execute the file as a shell script with output to the current window.

To delete the extension association for .ksh:

    registry -d -k "HKEY_CLASSES_ROOT\\.ksh"

To restore the extension association for .ksh:

    assoc .ksh mks_shell

To modify the registry entries for .ksh:

First display the file extension associations in the registry by using assoc:

    $ assoc .ksh
    .ksh mks_shell

This will return a file type association. Display the file type associations using ftype.

    $ ftype mks_shell
    mks_shell wstart -Nm sh.exe -H -- \"%1\" %*

If you want to change the command in the registry for executing .ksh files, here is a good alternative:

    $ assoc .ksh mks_shell_sh
    $ ftype mks_sh_shell
    mks_shell_sh "sh.exe" -- "%1" %*

Another solution would be to use the .sh extension for your shell scripts.