Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass empty parameter from command window
Message
De
16/04/2004 18:42:57
 
 
À
16/04/2004 00:15:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00894949
Message ID:
00895751
Vues:
15
>>>In the following example it ignores the fourth parameter altogether and takes the fifth one as fourth.
>>>
>>>MySQLBackup MyDatabase (local) sa " " "\\Targetmachine\TargetDisk\Targetdirectory"
>>>
>>>What I ended up doing is join several parameters within quotes in one and then unpacking them.
>>>
>>>MySQLBackup "MyDatabase,(local),sa,","\\Targetmachine\TargetDisk\Targetdirectory"
>>>
>>I totally mis-understood your question Alex.
>>
>>Now to make sure I'm not mis-understamnding again, when you say "command line", do you mean like a DOS window?
>
>Yes.
>
>>If you need to skip a parameter from the command line, you need to include an empty set of quotation marks. Using your example above, if you need to skip a second parameter, you need to do it like this:
>>
>>MySQLBackup "MyDatabase" " " "sa" "\\Targetmachine\TargetDisk\Targetdirectory"
>
>Unfortunately that doesn't work Fred. Your example will be interpreted exacly as if you had typed:
>
>>MySQLBackup "MyDatabase" "sa" "\\Targetmachine\TargetDisk\Targetdirectory"
>
>>So, how far off was I this time?
>
>You got the question, but not the answer, unfortunately :(

Interesting. If you use single quotes for the "empty" parameter, it skips things fine, but the parameter receives the set of quotation marks as its value. If you use double quotation marks, the parameter is not skipped at all! And even more curious is that if you need to have an embedded space, you must use the double quotation marks around your phrase. You can leave off the quotes if there are no spaces.

So you could have:
MYSQLBACKUP "mydatabase" '' sa '' "\Targetmachine\targetdisk\targetdirectory"

and you'd get:
p1 = mydatabase
p2 = ''
p3 = sa
p4 = ''
p5 = \Targetmachine\targetdisk\targetdirectory
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform