Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to launch PowerShell from Windows Explorer with Snap-Ins
    primarykey
    data
    text
    <p><a href="https://stackoverflow.com/questions/183901/how-to-start-powershell-from-windows-explorer">This question</a> answers how to launch PowerShell from Windows Explorer.</p> <p>I want to launch PowerShell from Windows&nbsp;Explorer with my TFS Shell Snap-In pre-loaded.</p> <p>I created a batch file (<em>RunPowerShell.bat</em>) with this command** and put it in the <em>System32</em> directory:</p> <pre><code>C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\tfshell.psc1" -noexit -command ". 'C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\TFSS </code></pre> <p>This works, but I'd like to do it with just typing "PowerShell" in the Windows&nbsp;Explorer address bar.</p> <p>Is it possible to load this snapin from Windows Explorer just by typing "PowerShell"?</p> <p>**The command shown above comes from the "Target" box of my PowerShell Console link in the menu option:</p> <p><img src="https://i.stack.imgur.com/AEgaB.jpg" alt="Enter image description here"></p> <hr> <h1>UPDATE</h1> <p>Chris N put me in the right direction.</p> <p>I had to do a few things to make it work, so I'll put them here:</p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/tfspowertools/thread/a116799a-0476-4c42-aa3e-45d8ba23739e/" rel="nofollow noreferrer">Create and register the following registry file</a> (*.reg) so that PowerShell would be aware of the TFS PowerShell DLL file:</p> <pre><code>Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.TeamFoundation.PowerShell] "PowerShellVersion"="2.0" "Vendor"="Microsoft Corporation" "Description"="This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "VendorIndirect"="Microsoft.TeamFoundation.PowerShell,Microsoft" "DescriptionIndirect"="Microsoft.TeamFoundation.PowerShell,This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "Version"="10.0.0.0" "ApplicationBase"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools" "AssemblyName"="Microsoft.TeamFoundation.PowerTools.PowerShell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" "ModuleName"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Microsoft.TeamFoundation.PowerTools.PowerShell.dll" "CustomPSSnapInType"="Microsoft.TeamFoundation.PowerTools.PowerShell.TFPSSnapIn" </code></pre> <p>In Notepad, create a new file with the following command:</p> <pre><code>if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Microsoft.TeamFoundation.PowerShell } </code></pre> <p>The <a href="https://stackoverflow.com/questions/1477994/how-to-check-if-powershell-snap-in-is-already-loaded-before-calling-add-pssnapin">IF statement prevents an error</a> if I load from the link in the Windows Menu.</p> <p>Then, save that file as this:</p> <pre><code>%windir%\system32\WindowsPowerShell\v1.0\profile.ps1 </code></pre> <p>This will make the command run for all shells and all profiles on Windows; read the link in Chris's answer if you need a smaller scope.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload