To get full path of powershell.exe programmatically

Shafi

I need to get the full path(absolute) of Powershell.exe to run powershell scripts in my code . Can anyone suggest me any library or inbuilt method to do this .

I tried boost filesystem's absolute() method and getFUllPathName() method in windows.h . But all i manage to get is the current working directory of my project .

Bathsheba

Alternatively (if you don't like to rely on environment variables) you can also query the registry. Powershell, on installation, writes a FriendlyTypeName value, which, on my machine is

@"%systemroot%\system32\windowspowershell\v1.0\powershell.exe", -107

which contains the path.

The registry key is HKEY_CLASSES_ROOT\Microsoft.PowerShellConsole.1\FriendlyTypeName

Use the Windows API to query the registry.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find full path of a powershell script launched from an EXE wrapper

From Dev

How to get the path of the installed Excel.exe programmatically?

From Dev

How to get the path of the installed Excel.exe programmatically?

From Dev

Get the latest version of software from PowerShell and get the respective exe path

From Dev

Powershell getting full path information

From Dev

Writing full path of an application in powershell

From Java

How to get full path of a file?

From Dev

How to get the full path of a directory

From Dev

Not Able to get the full path of the file

From Dev

Android get image full path

From Dev

Get full path and convert to constant

From Dev

Get full name of a method in PowerShell?

From Dev

Get executable (.exe) methods powershell

From Dev

Get executable (.exe) methods powershell

From Dev

PowerShell add full path to filename and copy

From Dev

Powershell executing .exe file without the folder path

From Dev

Executing an exe file in PowerShell in the path variable

From Dev

Powershell executing .exe file without the folder path

From Java

How to get resources directory path programmatically

From Dev

android gradle how to get module path programmatically?

From Dev

android gradle how to get module path programmatically?

From Dev

C++ get full path to file in directory

From Dev

Get full path to file from argument

From Dev

C# MVC Get full file path

From Dev

How to get the full path for USN journal query?

From Dev

How get full path with a http:// for a SRC image?

From Dev

Get reverse URL name from full path

From Dev

react router get full current path name

From Dev

how to get the full path of a page in javascript

Related Related

HotTag

Archive