#170452 - 2006-11-20 10:02 AM
Re: New Switch to support Free style Command Line arguments
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
No need for the Quit:
Code:
Break On For Each $arg in GetCommandline(1) If Left($arg,1)="$$" "Argument: "+SubStr($arg,2)+@CRLF EndIf Next
You just need to prefix your switch with a "$". Consider the following, which in order comprises a simple switch, a complex switch with a parameter and a bare parameter value:
Quote:
C:\Temp>kix32 cl.kix $/s $/p:"A switch with a parameter" $asimpleparameter Argument: /s Argument: /p:A switch with a parameter Argument: asimpleparameter
Using the "/" means that there is no chance of a variable namespace clash.
|
|
Top
|
|
|
|
#170454 - 2006-11-20 01:45 PM
Re: New Switch to support Free style Command Line arguments
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
I like the idea. This probably does not work right now, but it seams more intuitive: Code:
$args = split(GetCommandline(),"/")
Edited by Benny69 (2006-11-20 02:26 PM)
|
|
Top
|
|
|
|
#170456 - 2006-11-21 09:43 PM
Re: New Switch to support Free style Command Line arguments
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: CA
|
Yes, but we know you come from a different background 
I'm not saying one can't use or come up with ideas, methods for it's use, just curious why/how normal admins would use it.
I've been scripting now for quite a while and I've so far managed to run my scripts without it. Doesn't mean maybe I couldn't be more efficient though I suppose, just most scripts are one offs. Those that run often are typically already either part of Logon script, or the script contains all it needs to know to complete the task.
But hey if there is a real need for it then that's great, I hope Ruud listens to the suggestion.
|
|
Top
|
|
|
|
#185733 - 2008-02-26 06:52 PM
Re: New Switch to support Free style Command Line arguments
[Re: Lonkero]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
I love this idea, when i am at a remote site on our domain i dont like to sit there for 5 minutes waiting for drives,printers,etc to map. I can use this as a kill switch of sorts, prompting to ask if i want to do certain tasks or not.
Break On
For Each $arg in GetCommandline(1)
If Left($arg,1)="$$"
$cmd_arg=SubStr($arg,2)
EndIf
if $cmd_arg='administrator'
? "ITS OVER NINE THOUSAND"
endif
Next
|
|
Top
|
|
|
|
#185736 - 2008-02-26 07:28 PM
Re: New Switch to support Free style Command Line arguments
[Re: Glenn Barnas]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
maybe, but hopefully your not trying to map a drive to servers 10 miles away from the location. The logic is not the problem its just windows. In house it takes approx 3-4 seconds
Edited by duo (2008-02-26 07:28 PM)
|
|
Top
|
|
|
|
Moderator: Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 661 anonymous users online.
|
|
|