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

"Lüko Willms [email protected] [blat]" <[email protected]> Sun, 5 Mar 2017 07:33:15 +0100
Newsgroups gmane.mail.blat
Organization Willms-EDV - Lüko Willms
Message-ID <[email protected]>
Guten Tag FLAVIO BORUP [email protected] [blat],

am Freitag, 3. März 2017 um 19:21 schrieben Sie:


I´m building a backup.cmd batch file and trying to use the first argument in the batch file as parameter

I recommend using VBScript instead. 

There is always a confusion with the number of percentage signs you need. 

I tried recently a BAT in order to call a FOR command ... the FOR command also uses the % to indicate a variable, and that within a BAT is awful. 

Again: go VB Script (Visual Basic Script), and you are set. 

> First i test if there is no parameter in batch file name:
>
> if "%1" == "" goto END


In VBScript you do it this way: 

-------------------------------------
Option Explicit   ' cada varaible debe ser declarada 

Dim objArgs, fso, shl    

Set objArgs = WScript.Arguments
If objArgs.length <> 1 Then
MsgBox("Ese script precisa de exactamente um parametro")
Else
' faz o deseado 
End if 
---------------------------------------------------------




-- 
Mit freundlichen Grüßen
Lüko Willms
mailto:[email protected]