![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #2 (permalink) |
| Guest | Re: i don't think you should be allowed to do this klumsy@xtra.co.nz wrote: > i don't think you should be allowed to do this: > > set-Alias "," get-Process > dir alias: > &',' > > i think that you shouldn't be able to set as aliases things like build > in operators and keywords. > > Karl Why not? :-) It might be useful for debugging scripts, if nothing else. |
| | #3 (permalink) |
| Guest | Re: i don't think you should be allowed to do this my philosophy on these sorts of things have been pretty much a "you know what you're doing" approach - If you want to: buy a gun buy the bullets load the gun point it at your foot pull the trigger I figure, you did what you wanted to do, why should I tell you that you're wrong? I suppose I could warn you that you're going to shoot yourself in the foot, but, then again, if that's what you really want to do, you might just as easily get mad at me for warning you. Also, if I disallow the aliasing as you request, I wouldn't be able to create the alias foreach (foreach-object) - since foreach is a keyword as well as an alias. -- -- James Truher [MSFT] Windows PowerShell Development Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. <klumsy@xtra.co.nz> wrote in message news:1160276019.644246.99050@k70g2000cwa.googlegroups.com... >i don't think you should be allowed to do this: > > set-Alias "," get-Process > dir alias: > &',' > > > i think that you shouldn't be able to set as aliases things like build > in operators and keywords. > > Karl > |
| | #4 (permalink) |
| Guest | Re: i don't think you should be allowed to do this James, Nice explanation. I also think that there is nothing wrong that PowerShell allows funny named aliases (not only aliases, variables and functions too). For example for some reason I have a function '=' (I also could have an alias '=' instead) and I am quite happy to be allowed to do this. -- Thanks, Roman |
| | #5 (permalink) |
| Guest | Re: i don't think you should be allowed to do this "Roman Kuzmin" wrote: > I also think that there is nothing wrong that PowerShell allows funny named > aliases (not only aliases, variables and functions too). In general I prefer to allow only characters that contain: a-z / A-Z / 0-9 / _ In many programming languages only these characters are allowed or at least recommended to use for naming variables, functions and classes etc. Hence, I was suprised that PowerShell allows so many special characters, like for example the colon ":" in the wacky psdrive helper functions "a:" - "z:". I don't think this is a good idea. Sometimes it might be a good idea to protect people from doing stupid things (like using "funny" names for variables and aliases or even shooting in your foot). As with the foot, this will only cause pain when somebody (you?) has to read your obfuscated code. Btw.: What if we get the ternary operator ? : someday? What will happen with the ? alias for where-object cmdlet? This might cause some confusion... > For example for > some reason I have a function '=' (I also could have an alias '=' instead) > and I am quite happy to be allowed to do this. May I ask what this function does? -- greetings dreeschkind |
| | #6 (permalink) |
| Guest | Re: i don't think you should be allowed to do this "dreeschkind" wrote > May I ask what this function does? All right, though it's a bit personal and not essential . This is afunction which I never use in normal code; that is why I use a funny name, normal names are still free for normal functions. This function (omitting details) is something like that: param($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) ... Invoke-Expression $cmd where $cmd is taken, say, from the registry by name $0. Other parameters $1, .... $9 may be used in $cmd command template. E.g. Name: gv Value: Get-Variable -Scope global | sort Name | Format-Table * Example: =gv Name: wiki Value: [System.Diagnostics.Process]::Start("http://en.wikipedia.org/wiki/$1") Example: =wiki PowerShell In other words these are parameterised aliases with templates stored somewhere (in the registry). It is just a personal toy. I would not recommend it to somebody else, but if it is fun for me, why not? And in this case a funny name for funny thing looks quite natural. -- Thanks, Roman |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Access to directories not allowed | George | Vista performance & maintenance | 5 | 09-23-2007 07:55 PM |
| Uninstall not allowed in Vista | sbmmm | Vista installation & setup | 8 | 09-20-2007 10:38 AM |
| Folder listing not allowed | Jens Müller | Vista security | 1 | 03-25-2007 05:47 PM |
| Backup to CD-RW not allowed in Vista RC1? | alexander750 | Vista performance & maintenance | 9 | 11-07-2006 06:34 PM |
| Upgrade not allowed from Pre-RC1 to RC2 | =?Utf-8?B?Um9uIEhvbGRlcg==?= | Vista installation & setup | 3 | 10-08-2006 12:44 PM |