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

"'Jack Weaver' [email protected] [blat]" <[email protected]> Fri, 03 Mar 2017 17:23:34 -0500
Newsgroups gmane.mail.blat
Message-ID <[email protected]>
Try IF .%1. = .. GOTO END


--Original Message Text---
From: 'Chip' [email protected] [blat]
Date: Fri, 3 Mar 2017 15:01:40 -0700


  


> 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 â¬Sabc⬝ or â¬Sxyz⬝


> 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 â¬SContents 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 












-----------


Jack Weaver, Webmaster (Ret)
The Fanac Fan History Project http://fanac.org