PowerShell - Command Line with Arguments RRS feed

  • Question

  • I have scripts where I need to launch a command line with arguments.  Each time I need to write a new script to do this, it always seems to get more complicated (arguments) and I have to evolve my way of doing it.

    The latest script, I had to break it out like this, to get it to run:

    $CMD =  'c:\Program Files (x86)\Novadigm\radntfyc.exe'
    $arg1 =  'LOCALHOST'
    $arg2 =  'Radskman.exe'
    $arg3 =  'cat=prompt,ulogon=n,hreboot=y,context=m,mname=radia,dname=SOFTWARE,ip=server.domain.com,port=3464,uid=$MACHINE,startdir=SYSTEM,ind=y,cop=y,log=software_connect.log'
    & $CMD $arg1 $arg2 $arg3

    Is there a better way?

    There's no place like

    Tuesday, November 3, 2015 7:17 PM


All replies