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

"'Glenn B. Lawler' [email protected] [blat]" <[email protected]> Sat, 4 Mar 2017 17:35:43 -0600
Newsgroups gmane.mail.blat
Message-ID <!&!AAAAAAAAAAAYAAAAAAAAAH3fQh0qW/pHjsDKJ3Hs9vDCgAAAEAAAAKGMvCaKXf9PqHEB0y7IAi4BAAAAAA==@incodesystems.com>
IF “%~1”==”” GOTO END

 

From: [email protected] [mailto:[email protected]] 
Sent: Friday, March 03, 2017 4:24 PM
To: [email protected]
Subject: Re: [blat] Blat in CMD batch file - Using %1 first argument parameter

 



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 †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 






-----------

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