Re: Random psh stuff.



2/3) Sure! Other considerations were:

[C:\temp]
PS:55 > $random = new-object Random

[C:\temp]
PS:56 > $output = $null; 1..100 | % { $output += [char]$random.Next(97,
122) }; "$output.ps1"
wvrybyxwmtcftvhnsvbednocjrdkcyysjtwnhbkkfrgtamxxdbeckjjjgopivnumtjuaxsgrlpylhucvtegauwhajnhrlbnqwsyp.ps1

[C:\temp]
PS:57 > $output = $null; 1..100 | % { $output += [char]$random.Next(97,
122) }; "$output.ps1"
rwyjumqtjxbklsorgtrwbuqklnfjbhonulevewfhfnpllvgslvkcacowgowgggrbinpynsminjqneeypglwewlmswhopaxbxuocx.ps1

[C:\temp]
PS:58 > $output = $null; 1..100 | % { $output += [char]$random.Next(97,
122) }; "$output.ps1"
ggfsjbnqlbrbogytjmdvavcfevioirsocbjageuvwvhuomasxgohkfwjeynnryhsidynwynerhxdogpqupqcclevdavgpgexonml.ps1

[C:\temp]
PS:59 > $output = $null; 1..100 | % { $output += [char]$random.Next(97,
122) }; "$output.ps1"
mmuyrkodgttwjwschfqvxckwdgnlcynbtdditrjrvboifywsnbqjwpnkbxulvcahfscfskhpuxawnbqeiuxbieddpsgvvxutahdm.ps1

:)

Actually, the reason we have the $profile variable is to make this as short
as possible, while still serving our extensibility needs.

The PowerShell model supports the concept of multiple shells. For example,
the PowerShell.exe console application is the main shell. It has a certain
Shell ID. Karl Prosser's MshAnalyzer is another shell. It has its own
Shell ID. In the future, we will have a GUI host that also has its own Shell
ID. You may want code that runs in one of those shells, but not the others.
Access to $host.UI.RawUI is something that you would probably want to be
specific to a shell, for example.

In those situations, you would use the $profile variable. That variable
refers to the profile specific to the current shell. Its name derives
primarily from the Shell ID of the current shell. In contrast, the plain
"profile.ps1" file is loaded for every shell.

Technically, the PowerShell engine loads profiles in the following order:

1) "All users" profile is loaded from "\Documents and settings\All
users\PsConfiguration\profile.ps1"
2) "All users," host-specific profile is loaded from "\Documents and
settings\All users\PsConfiguration\Microsoft.PowerShell_profile.ps1"
3) Current user profile is loaded from "<My
Documents>\PsConfiguration\profile.ps1"
4) Current User, host-specific profile is loaded from "<My
Documents>\PsConfiguration\Microsoft.PowerShell_profile.ps1"

At this stage of the game, it doesn't really matter which you use if you use
only PowerShell.exe. I personally use the zenfully correct $profile to hold
my modifications, though.

4) This is not something that we would want to support broadly. If things
like "cd.." and "cd\" are important to you, it's best to add them as
functions to your profile.

--
Lee Holmes [MSFT]
Windows PowerShell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.


"William Stacey [MVP]" <william.stacey@xxxxxxxxx> wrote in message
news:utqphKVaGHA.1020@xxxxxxxxxxxxxxxxxxxxxxx
1) Powersh.exe used in places in the docs. Should be Powershell.exe I
guess.

2) Microsoft.PowerShell_Profile.ps1 - Could that be any longer?

3) "The profile Microsoft.PowerShell_profile.ps1 will only be run for the
shell with the matching ShellID..."
What does this mean in practice? What is the actual difference between
profile.ps1 and MS.powershell_profile.ps1?

4) In cmd.exe I can "cd\" or "cd\temp", but in ps I need a space like "cd
\"
or "cd \temp". Would this break too much to allow no space?

tia
--
William Stacey [MVP]





.



Relevant Pages

  • Re: Add to $PATH how?
    ... are sourced at the start of a "login" shell. ... the idea is that the .profile holds things that need doing exactly ... processes this need only happen once, and fresh interactive shells do ...
    (Fedora)
  • Re: how to make colour prompts for pdksh
    ... The .profile is always gets parsed (both in a login and a non-login ... your login shell, so your prompts will still be set, etc. ... your aliases would be there too. ... You need to export ENV. ...
    (Debian-User)
  • Re: some queris on .profile file
    ... I have created a new user on .profile file and was modifying the ... .profile file.but I do find some of the things while I login which ... Are we changing the shell here? ... Do we need this emacs setting? ...
    (comp.unix.tru64)
  • Re: Local policy, IE and SP2...
    ... the type of shell for each user profile. ... the policies are intended to make the user use the IE for internet browsing ... I will try to find some other solutions and maybe include some NTFS ...
    (microsoft.public.windowsxp.embedded)
  • Re: [PS] Vista Install Issues
    ... No virtualization occurs. ... Administrator credentials, the first two options would cause people to ... already one of the first and most common things that PowerShell users share. ... Finally PS want to create my profile script in the Vista user Documents ...
    (microsoft.public.windows.server.scripting)