• Passing null string commandline parameters

    From marcuswebster@marcuswebster@hotmail.com (Marcus Webster) to comp.os.ms-windows.misc on Thursday, August 07, 2003 04:21:33
    From Newsgroup: comp.os.ms-windows.misc

    I'm trying to pass three commandline arguments to a piece of third
    party software. The first argument I want to pass as ABC. The second
    argument I want to pass as a Null string. The third I want to pass as
    XYZ.

    Unfortunately it doesn't like me wrapping quote marks around the
    strings (they have to be passed in as ABC not 'ABC'). Which gives me
    the problem of how do I pass in the null string??

    Any ideas greatly appreciated. I'm running Windows XP.

    Cheers,
    Marcus.
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Phil Robyn@zipprobyn@uclink.berkeley.edu to comp.os.ms-windows.misc on Thursday, August 07, 2003 12:56:03
    From Newsgroup: comp.os.ms-windows.misc

    Marcus Webster wrote:

    I'm trying to pass three commandline arguments to a piece of third
    party software. The first argument I want to pass as ABC. The second argument I want to pass as a Null string. The third I want to pass as
    XYZ.

    Unfortunately it doesn't like me wrapping quote marks around the
    strings (they have to be passed in as ABC not 'ABC'). Which gives me
    the problem of how do I pass in the null string??

    Any ideas greatly appreciated. I'm running Windows XP.

    Cheers,
    Marcus.
    <Win2000> c:\cmd>demo\PassNullString ABC "" DEF
    parm1=ABC
    parm2=UNDEFINED
    parm3=DEF

    <Win2000> c:\cmd>demo\PassNullString "" 234 DEF
    parm1=UNDEFINED
    parm2=234
    parm3=DEF

    <Win2000> c:\cmd>demo\PassNullString "" "" DEF
    parm1=UNDEFINED
    parm2=UNDEFINED
    parm3=DEF

    <Win2000> c:\cmd>rlist demo\PassNullString.cmd
    =====begin c:\cmd\demo\PassNullString.cmd ====================
    1. @echo off
    2. setlocal
    3. set parm1=%~1
    4. set parm2=%~2
    5. set parm3=%~3
    6. for /l %%a in (1,1,3) do if not defined parm%%a set parm%%a=UNDEFINED
    7. set parm
    =====end c:\cmd\demo\PassNullString.cmd ====================

    --
    Phil Robyn
    Univ. of California, Berkeley

    u n z i p m y a d d r e s s t o s e n d e - m a i l

    --- Synchronet 3.18b-Win32 NewsLink 1.113