open with...

hello I am trying to open a .ps1 file(powershell file) with a C++ program. The problem I meet is that the .ps1 file is opening in Powershell ISE. I want to make it open with Powershell command line. Is there a function or a bunch of code that do so?

Thanks
Open powershell command line and pass your file as argument to it.
Or read on function you use to open file.
Thanks but I don't want to do it manually and I am not sure what function you are talking about.

Thanks!
The problem I meet is that the .ps1 file is opening in Powershell ISE
Which function do you use for that?
I want to make it open with Powershell command line
How do you do this normally (without a programm)
Last edited on
1) I am not using a function I am opening the .ps1 file the dumbest way, with system("start something.ps1");
I know, I know it is slow, but anyway...

2)I normally associate the .ps1 file with the Powershell command line, using right click of the mouse and then choosing open with... and then I just choose the program(Powershell command line)

3)I found that in the Internet is it relevant for my case?
ShellExecute(0, 0, L"c:\\outfile.txt", 0, 0 , SW_SHOW );
Last edited on
I normally associate the .ps1 file with the Powershell command line, using right click of the mouse and then choosing open with... and then I just choose the program(Powershell command line)
...So you will need to do so in programm: launch command line and pass script as parameter.
Alternatively, you can edit registry to enable different verbs to be used in execution of the pregramm and then use shellexecute:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
Topic archived. No new replies allowed.