My goal is simple: If a certain parameter occurs I want to delete if from the list of parameters.
I think showing a complete transcript is the best route to go here:
Simply put, that did not work at all (in fact, it seems to have done absolutely nothing), so below is a reasonable second try (although I expected the code above to work; not really so for the following code in which I simply deleted the minus sign in front of the "%I" on the "Shift" command):
So I was, in fact, correct in that expectation.
Simply put: What don't I understand? What am I doing wrong?
- Dan
I think showing a complete transcript is the best route to go here:
Code:
Thu Jan 19, 2012 4:52:28p
ISO8601 plugin v1.1.1 loaded.
SafeChars plugin v1.5.7 loaded.
Sift v0.55.0 loaded.
TCC 12.11.76 Windows 7 [Version 6.1.7601]
Copyright 2011 Rex Conn & JP Software Inc. All Rights Reserved
Registered to Daniel Mathews
[Z:\]Type TestShift.btm
@Echo Off
SetLocal
Set I=1
Do While %I LE %#
Set Arg=%[%I]
Iff "%@Left[2,%Arg]" == "/Z" Then
@Echo On
Shift -%I
@Echo Off
EndIff
@Echo I: %I %@Format[-3.3,%[%I] ] %%$: %$
Set /A I+=1
EndDo
EndLocal
Quit 0
[Z:\]TestShift a b c /z e f g
I: 1 a %$: a b c /z e f g
I: 2 b %$: a b c /z e f g
I: 3 c %$: a b c /z e f g
Shift -4
I: 4 /z %$: a b c /z e f g
I: 5 e %$: a b c /z e f g
I: 6 f %$: a b c /z e f g
I: 7 g %$: a b c /z e f g
Simply put, that did not work at all (in fact, it seems to have done absolutely nothing), so below is a reasonable second try (although I expected the code above to work; not really so for the following code in which I simply deleted the minus sign in front of the "%I" on the "Shift" command):
Code:
[Z:\]type TestShift.btm
@Echo Off
SetLocal
Set I=1
Do While %I LE %#
Set Arg=%[%I]
Iff "%@Left[2,%Arg]" == "/Z" Then
@Echo On
Shift %I
@Echo Off
EndIff
@Echo I: %I %@Format[-3.3,%[%I] ] %%$: %$
Set /A I+=1
EndDo
EndLocal
Quit 0
[Z:\]TestShift a b c /z e f g
I: 1 a %$: a b c /z e f g
I: 2 b %$: a b c /z e f g
I: 3 c %$: a b c /z e f g
Shift 4
I: 4 %$: e f g
So I was, in fact, correct in that expectation.
Simply put: What don't I understand? What am I doing wrong?
- Dan