1

I have a .ps1 file and I wanted to run the script when double-click! But a ps1 file is a script file so when you double click on in it opens a the notepad to edited.

So I what a way to execute the ps1 script!

I know that I can make a bat file and that execute the ps1 file and the problem with that is, that I need to files the .ps1 and a .bat! The problem that I'm facing is that there will be to files and so inconvenient...

So! Is there a way to make exe from a ps1 script?

3 Answers 3

2

Import this into the registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Microsoft.PowerShellScript.1\Shell]
@="0"

or run this on the command line:

set "key=HKCU\Software\Classes\Microsoft.PowerShellScript.1\Shell"
reg add "%key%" /v "" /t REG_SZ /d 0 /f

Both operations do the same: change the default action for PowerShell scripts to "Run with PowerShell" for the currently logged in user.

Sign up to request clarification or add additional context in comments.

Comments

0

you might try something like http://www.battoexeconverter.com/ You'll still need to create the bat file, but the two files(ps1 and bat) can be combined into a single .exe file for portability.

Comments

0

you might try PS2EXE http://ps2exe.codeplex.com/ (still beta though)

1 Comment

the .config is there a way to remove or not use it? the way i see it a just a xml telling the framework it useing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.