web analytics

Check the default browser

The following section in registry should be checked:

HKEY_CLASSES_ROOT\http\shell\open\command Key: (default)

Most (but not all) browsers check it to determine the current browser.

currentBrowser = RegistryGet("HKEY_CLASSES_ROOT","http\shell\open\command","") MsgBox( currentBrowser )

Some browsers could create additional section HKEY_CLASSES_ROOT\http\shell\OpenWith\command, which helps to avoid the conflict with IE settings.

WHICH command for DOS

If You need the analog of Unix ‘which’ command and do not have Resource Kit, the following batch file will help. The code was found on www.ss64.com Published with the permission of the author, Clay Calvert.

@echo off SETLOCAL (set WF=) :: Look for file in the current directory for %%a in ("" %!!%) do […]

How to find the version of DirectX

Start the dxdiag tool.

Windows XP: Start -> Run -> dxdiag

Windows Vista: Start -> Search -> dxdiag

…and if You could not find dxdiag, probably You do not have DirectX on Your machine. Are You still using old kind DOS box?

Read password in Unix shell

print -n "Enter Your password:"  stty_orig=`stty -g`  trap "stty ${stty_orig}; exit" 1 2 3 15  stty -echo >&- 2>&-  read PASS stty ${stty_orig} >&- 2>&-  trap 1 2 3 15 print

trap :catches interruptions. I.e. if the user presses Ctrl+C, the normal stty mode is set before stopping the program stty -echo :switches off the […]

Rev function and comma-separated output

Here is the shell command snippet to display comma-separated output:

ls -lrt | rev | sed ‘s/\\([0-9][0-9][0-9]\\)/\\1,/g’ | rev | sed ‘s/\\([\^0-9]\\),\\([0-9]\\)/\\1\\2/g;s/\^,\\([0-9]\\)/\\1/g’

Example: -rw-r—– 1 sybase dba 1,572,872,192 Feb 2 07:09 master.dbf

Rev in awk

#!/bin/ksh nawk ‘{ l=length($0) ; for(i=l;i>0;i–) { printf "%s", substr($0,i,1) } ; print "" }’

Rev function (absent on SunOS) […]

Find the files not in use in Unix

find . -name "*" -exec /usr/sbin/fuser {} 2>&1 \; | grep ”: *$”