puttyplink

putty plink -batch where the command has a semicolon as part of the parameters


I am trying to do the following:

plink -batch <user>@<server> <command> <parameter>

The parameter contains a semicolon ; like param="IP1;IP2"

The return says:

bash: IP2: command not found

I tried to look for a way to set ; delimiter off, so it was not expecting multiple commands.


Solution

  • Following dave_thompson_085's comment:

    Use backslash (\;). Unlike ssh-ing from Unix where the source shell might swallow it, Windows CMD and plink will send backslash to the server, and bash on the server will parse it as quoting (or escaping) the semicolon

    I changed it to

    plink -batch user@server command parameter\\;Parameter_continued
    

    which solved the problem.