Running tcl scripts directly on Windows command line

A significant irritation that I have been experiencing in windows is wanting to run tcl scripts that accept command lines directly in the command shell ( cmd.exe ). Several solutions involve creating .bat/.com files to provide the arguments to the tclsh executable and using the start command to invoke the whole mess. Thus you have a bat/com file for every tcl script what nonsense. For example the small script which I called argscheck.tcl below:

global argv0 argv argc env 

puts "num args = $argc " 
puts "argv0 = '$argv0'"
puts "argv = '$argv'"

Running the following in a cmd.exe window:

C:\projects>argscheck.tcl 23 45 "the rain in spain"
num args = 0
argv0 = ''
argv = ''

After realizing that each file type has an associated executable I was able to find these associations in the windows registry using "tclsh" as my search key ( using regedit)

HKEY_USERS\...\Applications\wish86.exe\shell\open\command  
 ->   Default  REG_SZ "C:\Tcl\bin\tclsh86.exe" "%1"
HKEY_USERS\....\Applications\tclsh86.exe\shell\open\command
 ->   Default  REG_SZ "C:\Tcl\bin\tclsh86.exe" "%1"

I changed the arguments to the following so that it accepts more than the filename:

HKEY_USERS\...\Applications\wish86.exe\shell\open\command  
 ->   Default  REG_SZ "C:\Tcl\bin\tclsh86.exe" "%1" %*
HKEY_USERS\....\Applications\tclsh86.exe\shell\open\command
 ->   Default  REG_SZ "C:\Tcl\bin\tclsh86.exe" "%1" %* 

after the small change we get exactly what we want. Hooray! Hope this helps people.

C:\projects>argscheck.tcl 23 45 "the rain in spain"
num args = 3
argv0 = 'C:\Users\Bezoar\bin\argscheck.tcl'
argv = '23 45 {the rain in spain}'