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

"FLAVIO BORUP [email protected] [blat]" <[email protected]> Mon, 6 Mar 2017 12:38:54 +0000
Newsgroups gmane.mail.blat
Message-ID <MWHPR14MB1581FDADC953A3890D491FC6D32C0@MWHPR14MB1581.namprd14.prod.outlook.com>
Worked perfectly using “%1” insted “%1%”




De: 'Chip' [email protected] [blat]<mailto:[email protected]>
Enviado:sexta-feira, 3 de março de 2017 19:02
Para: [email protected]<mailto:[email protected]>
Assunto: Re: [blat] Blat in CMD batch file - Using %1 first argument parameter



> 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