Rob I do try to take things at face value. I went back over what has been said and haven't found where you or anyone has said that it's created each time a scipt is run. Very likely I misunderstood something. My assumptions are only testing what I think so I know whether or not I get it. Since I now know it's created new each time something is run that makes a big difference to my understanding. It's fine to tell me to take your posts at face value but if I'm left with a question about it the face value is not a value. I'm not trying to be disrespectful however what is plain to you isn't to me. So Merry Christmas and thank you for the excellent discussion
Posts made by chutestrate
-
RE: Understanding $args in PowerShell
-
RE: Understanding $args in PowerShell
So unless other arrays are created $args would be the only array with many elements contained within it.
-
RE: What Are You Doing Right Now
Finally getting a clue about $args and arrays with the help of some really knowledgeable people. Thanks Scott and Rob
-
RE: Understanding $args in PowerShell
I think you are right. I'm stuck between $args and arrays. Fine, $args is an array to use or not use. Then $args[0] and $args[1] are different arrays?
-
RE: If you are new drop in say hello and introduce yourself please!
Thank you all for the welcome.
-
RE: If you are new drop in say hello and introduce yourself please!
@scottalanmiller I am close to Yardley, Pa. Right along the Delaware river across from not so safe and ugly Trenton, NJ.
-
RE: Understanding $args in PowerShell
sigh. I just don't think this is going to happen. I think it's been explained as many ways as possible, and I keep missing the message.
I think it's time to let this go.
The support has been terrific thank you.
-
RE: Understanding $args in PowerShell
Ok, I'm kinda with you at this point. Correct me if anything I'm thinking is incorrect. I'm using english, not the correct terms.
I understand that $args is automatic. I believe the mental block is the where it is an array, or is it creating and naming an array [$args[0], $args[1], etc.) Wait, you told me that the numbering of $args is how powershell is matching the automatic creation of $args to an array? So each auto creation of $args is an array?
I believe I'm ok with the concept of explicitly creating and naming an array.
What I'm having the heartburn over is how $args is an array, or creates an array, or was just put there to drive me a little crazy. Do you have to put it in the code you are developing? I've been given some code examples that included it. Were these just examples of what would look like or is it necessary to be used if not creating/naming an array. If it is automatic how do you use it later on?
Hopefully, these questions give some kind of hint to my confusion.
Thanks again for all the support.
-
RE: Understanding $args in PowerShell
I need to correct my last post. I understand the named parameter demo, but not the $args piece of it.
-
RE: Understanding $args in PowerShell
Rob thank you for doing that. I've watched it a few times, and I'm not catching what you are trying to demonstrate. I'm sorry.
-
RE: Understanding $args in PowerShell
No snow. Just my part of the block. Have a safe trip
-
RE: Understanding $args in PowerShell
Well for whatever reason I just lost power so maybe it's a good reason to look things over again tomorrow. Plus trying to type on phone is tough. I'll try to make the connection of $args again.
-
RE: Understanding $args in PowerShell
Yeah, I'm kinda good like that, not in a good way. Ok, done with that then. Well, that is the source of my confusion of the "args is an array" now that I'm re reading it.
ok
-
RE: Understanding $args in PowerShell
Ok, so is this explanation misleading or am I just not reading it correctly. This is where I started going crazy with args.
There is a special variable $Args which contains an array of the parameters passed to a function. Let’s use this variable to show how we can pass an argument using string expantion.
Function HAL {“What are you doing $args ?”}<enter>
Type in the FunctionName and an Argument:
HAL DaveYou can use multiple $Args variables to pass more than one parameter.
-
RE: Understanding $args in PowerShell
I'm actually following that. But the $args to array thing....
This isn't stating that $args is?
for ($i=0; $i -lt $args.length; $i++) {
"This is `$args[$i], which is: $($args[$i])"
}