lelegard / qtlinguist-installers

Standalone binary installers for Qt Linguist
101 stars 12 forks source link

Run powershell script by command line #12

Closed bovirus closed 6 years ago

bovirus commented 6 years ago

@lelegard

How can run powershell from MSDOS prompt but the standard command (ex. form windows sub-folder)

powershell -file build-windows.ps1

didn't work. Just works

powershell build-windows.ps1

How can run this .ps1 powershell script without pause at the end of compilation? I want to create a dos batch that can help user to compile exe/zip file.

lelegard commented 6 years ago

With all due respect, I think you do it the wrong way. Invoking powershell from DOS is an anachronism. Powershell was designed to replace DOS, completely. System administrators implement their automation directly using powershell. I never use DOS command windows, just powershell command windows. And you can run powershell scripts directly from the explorer. Etc. See the numerous tutorials and books about powershell.

The pause is done by default so this is more convenient when you just run the script from the explorer. To bypass it, use option -NoPause. See the README file.

bovirus commented 6 years ago

@lelegard

Could be.

I believe that for most novice/basic users (not developers) it's more clear and common make a double click on dos batch like windows-compile.bat that invoke powershell.

lelegard commented 6 years ago

To execute the powershell script from explorer, right-click on it and select "Execute".

Like most users, I configured explorer to execute a powershell script by simply double-clicking on it (like a dos batch file) using the following registry entry:

[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell\open\Command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -ExecutionPolicy RemoteSigned -File \"%1\""

Should I add that, to solve all that mess, my main machine is now a Mac, Windows running in a VM only when I need it :)

paulvill76 commented 5 years ago

Hi all , I tried that and Still have execution policy blocked , i enroll myself my workstation to Azure , i cannot believe is related , there no GPO yet in place I will look for the keys in registry to modifyf