1.

Solve : Command Line Paramters?

Answer»

I've got a generic bat file, sasmenow, with four command line parameters. It's got long path strings in it. The four command line paramters, which represent file names and or path-filenames, have some blanks in them. For EXAMPLE the first parameter is 'auth clms'. Is there an escape character that allows the parser to group 'auth clms' while keeping the blank?DOUBLE quotes are what you need:

sasmenow "parm 1" "parm 2" "parm 3" "parm 4"

Good luck. 8-)Sidewinder,

Thanks for the input. Let me back up and give a more complete picture. The generic sasmenow is invoked by a second bat file, say sas_applctn, which passes the four parameters off. The first parmeter is a path, the second a filename the third an output filename, etc.; each parm may contain embedded blanks. (I do this because the path names are really long.) Each of these is put together inside of sasmenow to arrive at a complete path-filename. What happens when I put these together with "" is such that inside double quotes don't disappear as they do in VB. For example %1 is 'c:\projects\er admits\', %2 is 'do eradmits.sas', etc. so that putting "" around %1 and %2 LEADS to "c:\projects\er admits\""do eradmits.sas" inside sasmenow which drives the interpeter SILLY. Is there no escape character for blanks or a way to mask blanks?

Tony Dee in Tulsa, OK Quote

Let me back up and give a more complete picture


Use the %~n format of the runtime parameter which will strip away the quotes but maintain the integrity of each parameter. Replace n with the ACTUAL number of the parameter. You may have to insert the leading and trailing double quotes back into the reconstructed string.

If you know VB, consider using VBScript for this. You might want to consider sending the parameters fully constructed from the calling program. There is a 255 character limit on runtime parameters; shouldn't be an issue. Or consider using the file shortname.

Happy Computing. 8-)Sidewinder, Dat worked great. Thanks.


Discussion

No Comment Found