[Solved] Open Powershell (prompt) from current directory - and elevated rights

English support forum

Moderators: Stefan2, white, sheep, Hacker

Post Reply
dungn
Junior Member
Junior Member
Posts: 3
Joined: 2017-01-05, 21:57 UTC

[Solved] Open Powershell (prompt) from current directory - and elevated rights

Post by *dungn » 2019-05-15, 08:30 UTC

For long i have used a shortcut file to open command prompt in current working directory, like this:

SHORTCUT.lnk /k cd /d %P

where .lnk file just open "C:\Windows\System32\cmd.exe".

Now with Powershell beeing dominant in my work, i like to do just the same, only now with Powershell prompt? :?:

So far i came up following, but it only opens powershell and 'verbosing' the correct current directory, but the actual directory is still
<PS C:\windows\system32> :

command = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit
syntax = -command "'%P'"
Last edited by dungn on 2019-05-15, 13:42 UTC, edited 1 time in total.

User avatar
obeg
Junior Member
Junior Member
Posts: 34
Joined: 2006-09-28, 09:20 UTC
Location: Sweden

Re: Open Powershell (prompt) from current directory

Post by *obeg » 2019-05-15, 08:47 UTC

I don't know it is sufficient for you, but I use the Start menu in Total Commander

Command: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Parameters: -noexit -command "cd '%p'"

The command needs to be surrounded by double quotes " and %p by single quotes '

br /ola

User avatar
Stefan2
Power Member
Power Member
Posts: 2487
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Open Powershell (prompt) from current directory

Post by *Stefan2 » 2019-05-15, 10:15 UTC

 

Just launch PowerShell.exe, TC will do the rest and ask PS to change to the path of the current active panel.

Code: Select all

Command    = powershell -NoExit 
Parameters = 
Start path = 
Icon file  =  powershell 
Tooltip    = Launch PS in current path

Ready to paste button:

Code: Select all

TOTALCMD#BAR#DATA
powershell -NoExit

powershell
Launch PS in current path


-1
 

dungn
Junior Member
Junior Member
Posts: 3
Joined: 2017-01-05, 21:57 UTC

Re: Open Powershell (prompt) from current directory

Post by *dungn » 2019-05-15, 13:31 UTC

Just launch PowerShell.exe, TC will do the rest and ask PS to change to the path of the current active panel.
O-m-goodness. The simplest solution is often the genius one. Thank you "Stefan2".


And actually, my full question was how to open Powershell with elevated rights also. Thank you "obeg", you proved the best answer for my problem:
-noexit -command "cd '%p'"
Last edited by dungn on 2019-05-15, 13:36 UTC, edited 1 time in total.

User avatar
Stefan2
Power Member
Power Member
Posts: 2487
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Open Powershell (prompt) from current directory

Post by *Stefan2 » 2019-05-15, 13:36 UTC

dungn wrote:
2019-05-15, 13:31 UTC
...

And actually, my full question is, how to open Powershell shortcut with Elevated Rights...

...




Open the button for modifying > click [Help] and read:
Command: ................
1. You may specify ...........
.............. Put an asterisk '*' in front of the name to start it with administrative rights,


Command = *powershell -NoExit
Parameters =
Start path =
Icon file = powershell
Tooltip = Launch PS in current path as Admin






HTH?

dungn
Junior Member
Junior Member
Posts: 3
Joined: 2017-01-05, 21:57 UTC

Re: Open Powershell (prompt) from current directory

Post by *dungn » 2019-05-15, 13:40 UTC

Thank you again Stefan2. I did not know that also.


Luving Total Commander since Windows Commander.... :)

Post Reply