|
|
|||||||
Currently, kix32.exe only accepts variables in the format of $var="blah", a few predefined switches, and/or additional script names as arguments. If you try to provide any other type of argument, it causes an error. With the current addition of the getcommandline() function, I would like to suggest adding another switch to kix32.exe that would allow you to use your own structure for arguments. For example: Code:
Once the /o switch is set to kix32.exe, it would allow the user to define variables in the format they choose, and they would have to handle the variables in the code via the getcommandline() function. In the mean time I did find a workaround that would allow some degree of open arguments, but it requires that the script end with "Quit" to keep it from trying to run the arguments as scripts. For example: kix32 script.kix 1234567890 abc edf Code:
Returns: Quote: |
||||||||
|
|
|||||||
Well I'm not trying to squash your idea, but curious how you really use this behavior in day to day tasks. This seem almost more like batch files, ie.. I don't call too many options like that myself. I call a lot of scripts from the command line but they almost all are self contained or call other UDFs on their own. Are you wanting to support some type of modular library by command line? |
||||||||
|
|
|||||||
Personally, right this minute, I have no immediate use for it, however in the past I would have like to have been able to do it this way. I've seen numerous other posts asking for a way to do it, and even vbscript supports it. I guess I look at the way Kixtart does arguments as limiting, and with the addition of the getcommandline function, now it just seems like an easy fix to allow that flexablity. |
||||||||
|
|
|||||||
me too. |
||||||||
|
|
|||||||
No need for the Quit: Code: Break On 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: Using the "/" means that there is no chance of a variable namespace clash. |
||||||||
|
|
|||||||
imho, all non kix switches should be allowed to pass. using some sort of $ thingie like shown above does work, but makes it harder than it needs to be. |
||||||||
|
|
|||||||
I like the idea. This probably does not work right now, but it seams more intuitive: Code:
|
||||||||
|
|
|||||||
Hey Doc! I can't count (on both hands and feet!) the number of Kix scripts I have that need Bat files to feed command line args to them! In fact, thinking about it, I have more scripts that work using (sometimes optional) command line args than those that don't. Just my experience... Glenn |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
Just played with this.. quite handy, actually. I associated .KIX with Kix32.exe. When I edit the OPEN association in the registry and change the command from: c:\local\bin\kix32.exe "%1" to: c:\local\bin\kix32.exe "%1" "%*" I can create a kix script and invoke it like any other bat or exe file: Code: KixScript -a -q -362 will return an array of 3 elements. The first element is the path to the kix32 executable (C:\local\bin\kix32.exe), the second is the path to the script (C:\work\test.kix), and the third is all the command line args (-a -q -362). The third arg can be split and parsed easily. I have experienced Allen's issue - the last line of the script must be a Quit 0 - a small price to pay for this feature. The mod that Les offered only seems to work if you continue to use the $VAR=value method, although it does not require the quit. Glenn |
||||||||
|
|
|||||||
Huh? What did I do? If I were rich, I could understand mixing us up but I am poor. |
||||||||
|
|
|||||||
No! Not you, Les! The "other" Les! - er - Richard! (sorry - I thought it was safe to post with the problem juggling dropped to 6 or 7 items. Apparently, I was mistaken!) Glenn |
||||||||
|
|
|||||||
I see that the followup post has disappeared.. After additional experimentation, I found that if you add a "/' before the "%*", the Quit 0 is not required. The down side is that you have a leading null "/" The registry key I mentioned earlier can be defined as: c:\local\bin\kix32.exe "%1" "/%*" By doing this, you can run a Kix script with any kind of command line args - for example - BedRock.Kix /Flintstones Fred Wilma Barney Betty, and GetCommandLine(0) will return: "C:\local\bin\kix32.exe" "K:\Misc\cl.kix" "/ /Flintstones Fred Barney Wilma Betty" You can easily trim the leading "/ " and get the args you need. Glenn |
||||||||
|
|
|||||||
cool. |
||||||||
|
|
|||||||
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. Code: 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 |
||||||||
|
|
|||||||
5 minutes for a login script??! Something's gotta be wrong there. Even at our small branch offices with a 256K Frame connection, it takes no more than about 20 seconds to decide on up to 21 drive connections based on 39 group or OU membership comparisons. You might want to revisit the logic if a login script takes that long! Glenn |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
We have several hundred branches, all over the US, which communicate to servers here in NJ. No branch has its own file server - so, yes, we're communicating with sites more than 10 miles away. The branches use Frame Relay links for communication, with the smallest branches using 256Kbps channels (128K nominal, 256Kbps burst). The Kix32 loads from the NetLogon share, so the time includes loading Kix, the script, and the config file. Glenn |