View Single Post
Old 06-27-2008   #2 (permalink)
Jacob Saaby Nielsen


 
 

Re: Strategy for handling parameters to a script

Hey,

perhaps I should supply an example.

Let's say TestScript had 10 possible parameters you could pass to it.

E.g. "TestScript /whatever:0 /morewhatever:4 /evenmorewhatever:hellno" and
so forth.

How do you:

1. Best make the script do what it should do, based on the values in those
parameters
2. Any difference to using /command, -command or something else ? Does PS
require something particular here ?
3. How do you best make the script avoid the parameters NOT set ? E.g. in
the above example, 7 are missing of the 10 - how do you stick to the script
JUST using the 3 that are used ?

I'm looking for any and all ways to do it, since it's simply for inspiration
for finding a way that works (for me), and I was kinda wondering

Best Regards,
Jacob Saaby Nielsen

http://www.ijacob.info
gmail: jacob DOT saaby
hotmail (IM/LinkedIN/Facebook): same as gmail
Quote:

> Hey guys,
>
> anyone got any good way to handle parameters to a script ?
>
> E.g. the script takes certain parameters.
> What's the best way to check if they're set, and if they are to use
> them,
> if they're not, how to not use them.
> Anybody did something they wanna share in that regard ?
>
> I'm thinking something that builds a command, but there might be a
> much better way.
>
> Please share how you accomplish this
>
> Best Regards,
> Jacob Saaby Nielsen
> http://www.ijacob.info
> gmail: jacob DOT saaby
> hotmail (IM/LinkedIN/Facebook): same as gmail

My System SpecsSystem Spec