Re: Blat in CMD batch file - Using %1 first argument parameter

"'Chip' [email protected] [blat]" <[email protected]> Fri, 3 Mar 2017 15:01:40 -0700
Newsgroups gmane.mail.blat
Message-ID <B7CD4FF075B24B0787138A9CBA8970EE@chip>
> I´m building a backup.cmd batch file and trying to use the first argument 
> in the batch file as parameter
>
> First i test if there is no parameter in batch file name:
>
> if "%1" == "" goto END
>
> so, every time the bath is used, i have to put a first argument, in my 
> case, a 3-letter acronym like “abc” or “xyz”
>
> the command line is:
>
> blat - -body "ERRO - %ROTINA%" -server %SMTPSERVER% -to %CXPOSTAL% -f 
> %COMPUTERNAME%%@%DESTDOMAIN% -subject "Backup OFFSHORE MAXIMO em %DATE% de 
> %COMPUTERNAME%"
>
> this example above Works well, but...
>
> if i try to use:
>
> -subject "Backup OFFSHORE MAXIMO de %1% em %DATE%”
>
> Thing get weird!,
>
> the subject is changed to “Contents of file: bakora_MAXIMO_sex_als.LOG” 
> insted my custom subject
>
> But..
>
> If i try to use %1% as the last parameter, things got more weird:
>

<snipped>

Batch command parameter %1% should be %1 instead.  If you want to use more 
batch command line parameters (%2, %3, etc.), these use only one % symbol. 
Environment variables are represented with the % symbol at the front and end 
like you did, but batch arguments use only one % symbol.

Chip