Fred... Speaking as someone who does a bit with Win32 scripting (and used to do much more with it on Unix in college) you know of course that you are working with implements "poorly suited for their intended purpose". :) - of course, your options are limited...
I tried the script you showed on XP, and I get the same server not found error whether I am using it with or without the optional args embedded, no matter what the version of viewer I use. A VBScript may be much cleaner for you, and one which gives you a clean command line is fairly trivial to write if you know WSH very well. I went ahead and wrote a wrapper for this in VBScript. This should work as far as giving you a clean command line, and executes properly with WSH 5.6 ( you may need to update your version of WSH to make it work, but I doubt it). If you DO need to update, the download should be http://download.microsoft.com/download/winscript56/Install/5.6/W9XNT4Me/EN-US/scr56en.exe for a North American English version that works on Me. If it works, in "payment" I would like to hear what you are doing and why you are using so many configurations - I do a lot with remote control tools from Windows clients, and your situation sounds alittle interesting.... SCRIPT FOLLOWS NOTES ------------------------------------------------------------------------------------------------- (1) To make linewrap issues apparent, I have numbered the lines. (2) This should work whether you have cscript or wscript defined as your "default" WSH environment. (3) To "see" the command line, uncomment line 027. (4) If you make mods to this, make sure that any paths with embedded spaces are wrapped with quotes (as in line 009, a never-documented and ever-present irritation in VBScript and Jscript) AND make certain you have spaces attached between components. ---------------------------------------------------------------------------------------------- 001. 'INITIALIZE OBJECTS 002. 'init arguments object 003. Set objArgs = WScript.Arguments 004. 'init the Shell object so we can issue a shell command to run the command line when we are done 005. Set objShell = WScript.CreateObject("WScript.Shell") 006. 007. 'INITIALIZE VARIABLES 008. ' Use the chr(34) to wrap quotes around path with spaces in it 009. cmdBase = chr(34) & "C:\Program Files\ORL\vncviewer.exe" & chr(34) 010. 'here's the static options you want 011. cmdMid = "-encoding hextile -compresslevel 9 -quality 0 -noshared -noemulate3 -fullscreen" 012. 'init the arguments to nothing 013. cmdArg = "" 014. 015. 'BUILD COMMAND LINE ARGUMENT SECTION 016. For I = 0 to objArgs.Count - 1 017. 'build a command line out of parsed arguments, one space between each 018. cmdArg = cmdArg & " " & objArgs(I) 019. Next 020. 021. 'ASSEMBLE AND CLEAN THE LINE 022. 'chop any leading/trailing whitespace 023. cmdLine = trim(cmdBase & " " & cmdMid & " " & cmdArg) 024. 025. 'TEST IT IF YOU WANT 026. 'Following line if uncommented will show you what your line looks like, delimited with a period at start and end 027. 'WScript.Echo "." & cmdLine & "." 028. 029. 'DO IT 030. 'The following line runs the command so that vncviewer is VISIBLE (1) and script does NOT wait until apps exits, but terminates ("true"). 031. objShell.Run(cmdLine, 1, true) ---------------------------------------------------------------------------------------------- ----- Original Message ----- From: "Shing-Fat (Fred) Ma" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday/2001 December 31 03:05 Subject: Weird quirk in MSDOS batch wrapper for vncveiwer : Hello, : : Hope all the traffic I'm generating on this list eventually does some : good e.g. for anyone else who may run into similar situations. : : I'm more of a unix guy writing an MSDOS batch wrapper on my WinME : machine for the vncviewer. Eventually, I will replace all my slightly : different shortcuts to the vncviewer with the wrapper. Since the : wrapper takes care of most of the desired options, it would be easy : to compare the different shortcuts and modify them when needed. It is : also easy to do global modifications on the wrapper itself. I also : avoid having a listening daemon on the system tray, just to retain : my favoured default settings. : : After doing some reading on MSDOS (and ruling out the possibility : of cygwin bash wrappers for various reasons), I came up with a one-line : wrapper: : : c:\progra~1\tightvnc\vncviewer.exe -encoding hextile : -compresslevel 9 -quality 0 -noshared -noemulate3 : -fullscreen %1 %2 %3 %4 %5 %6 %7 %8 %9 : : If I invoke this wrapper without any arguments, : VNC complains that it failed to connect. It works fine : if I leave out the % variables, but that doesn't allow the wrapper : to be supplied with additional options (possibly overriding the : hard coded options in the wrapper). It also works if I specify : a server after all the % variables, but that makes the wrapper : too specific. : : I thought that the problem is that the series of : spaces after the -fullscreen option is being mistaken for a : server specification, but I don't get the error if I type the command : at the DOS prompt (with spaces at the end instead of the : % variables). : : I even replaced the vncviewer.exe with an : invocation of my own debugging script just to see whether : those extra end spaces were being meaningfully interpretted : (e.g. as a server specification), but all argument variables : after -fullscreen have zero length (confirmed with : the command "echo %%3=_%3_", for example). The arguments : beyond -fullscreen were obtained by 10 consecutive MSDOS "shift" : commands, and I verified that I was looking at them : by adding a few extra dummy arguments after -fullscreen. : : Anyway, I'm at a loss as to why I'm getting the error, and it : seems to be an interplay between how MSDOS passes : arguments to a binary executable, and how the executable : handles extra spaces at the end of the command line. If : anyone more experienced in MSDOS scripting can suggest : an explanation (and maybe a workaround), that'd be great. : : Thanks. : : Fred : -------------------------------------------------------------------------- : Fred Ma : Department of Electronics : Carleton University, Mackenzie Building : 1125 Colonel By Drive : Ottawa, Ontario : Canada K1S 5B6 : [EMAIL PROTECTED] : ========================================================================== : --------------------------------------------------------------------- : To unsubscribe, mail [EMAIL PROTECTED] with the line: : 'unsubscribe vnc-list' in the message BODY : See also: http://www.uk.research.att.com/vnc/intouch.html : --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, mail [EMAIL PROTECTED] with the line: 'unsubscribe vnc-list' in the message BODY See also: http://www.uk.research.att.com/vnc/intouch.html ---------------------------------------------------------------------