powershell

Powershell test for noninteractive mode

…衆ロ難τιáo~ 提交于 2021-02-06 14:54:07
问题 I have a script that may be run manually or may be run by a scheduled task. I need to programmatically determine if I'm running in -noninteractive mode (which is set when run via scheduled task) or normal mode. I've googled around and the best I can find is to add a command line parameter, but I don't have any feasible way of doing that with the scheduled tasks nor can I reasonably expect the users to add the parameter when they run it manually. Does noninteractive mode set some kind of

How to invoke cmake from powershell using MinGW generator

家住魔仙堡 提交于 2021-02-06 14:01:00
问题 I am trying to invoke cmake from powershell so that I can build project with MinGW compiler. It works fine for Visual Studio generator, and it also work when I use cmake-gui, however from powershell I get this error: cmake ..\..\huggle -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe -- The C compiler identification is unknown -- Check for working C compiler: C:/Qt/Tools/mingw491_32/bin/gcc.exe -- Check for working C compiler: C:/Qt/Tools/mingw491_32/bin

How to invoke cmake from powershell using MinGW generator

岁酱吖の 提交于 2021-02-06 13:58:37
问题 I am trying to invoke cmake from powershell so that I can build project with MinGW compiler. It works fine for Visual Studio generator, and it also work when I use cmake-gui, however from powershell I get this error: cmake ..\..\huggle -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe -- The C compiler identification is unknown -- Check for working C compiler: C:/Qt/Tools/mingw491_32/bin/gcc.exe -- Check for working C compiler: C:/Qt/Tools/mingw491_32/bin

Invoking functions from nested modules in a script module do not always trigger a module to autoload

青春壹個敷衍的年華 提交于 2021-02-06 10:58:01
问题 If I create a manifest module with nested modules, exported functions from all nested modules after the first do not appear in the list of available commands and don't trigger the module to autoload. They also do not appear when I run "Get-Module -ListAvailable". Only the exported functions from the first nested module appear in the list of commands. If I explicitly import the module, all exported functions are available. In the example below, Update-LegacyServices is not available until the

Invoking functions from nested modules in a script module do not always trigger a module to autoload

断了今生、忘了曾经 提交于 2021-02-06 10:57:27
问题 If I create a manifest module with nested modules, exported functions from all nested modules after the first do not appear in the list of available commands and don't trigger the module to autoload. They also do not appear when I run "Get-Module -ListAvailable". Only the exported functions from the first nested module appear in the list of commands. If I explicitly import the module, all exported functions are available. In the example below, Update-LegacyServices is not available until the

PowerShell FINDSTR eqivalent?

[亡魂溺海] 提交于 2021-02-05 20:24:55
问题 What's the DOS FINDSTR equivalent for PowerShell? I need to search a bunch of log files for "ERROR". 回答1: Here's the quick answer Get-ChildItem -Recurse -Include *.log | select-string ERROR I found it here which has a great indepth answer! 回答2: For example, find all instances of "#include" in the c files in this directory and all sub-directories. gci -r -i *.c | select-string "#include" gci is an alias for get-childitem 回答3: Just to expand on Monroecheeseman's answer. gci is an alias for Get

PowerShell FINDSTR eqivalent?

一曲冷凌霜 提交于 2021-02-05 20:21:34
问题 What's the DOS FINDSTR equivalent for PowerShell? I need to search a bunch of log files for "ERROR". 回答1: Here's the quick answer Get-ChildItem -Recurse -Include *.log | select-string ERROR I found it here which has a great indepth answer! 回答2: For example, find all instances of "#include" in the c files in this directory and all sub-directories. gci -r -i *.c | select-string "#include" gci is an alias for get-childitem 回答3: Just to expand on Monroecheeseman's answer. gci is an alias for Get

PowerShell FINDSTR eqivalent?

扶醉桌前 提交于 2021-02-05 20:20:24
问题 What's the DOS FINDSTR equivalent for PowerShell? I need to search a bunch of log files for "ERROR". 回答1: Here's the quick answer Get-ChildItem -Recurse -Include *.log | select-string ERROR I found it here which has a great indepth answer! 回答2: For example, find all instances of "#include" in the c files in this directory and all sub-directories. gci -r -i *.c | select-string "#include" gci is an alias for get-childitem 回答3: Just to expand on Monroecheeseman's answer. gci is an alias for Get

VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

佐手、 提交于 2021-02-05 12:52:13
问题 I design websites in VSC and PowerShell is my default terminal. After updating and deploying a website to firebase earlier, I was prompted to update firebase tools - which I did using npm. Immediately after I cannot run/access any firebase scripts wthout the folllowing error: firebase : File C:\Users\mada7\AppData\Roaming\npm\firebase.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/

Why is my locally-created script not allowed to run under the RemoteSigned execution policy?

妖精的绣舞 提交于 2021-02-05 12:41:40
问题 Since this question continues to attract responses that are either refuted by the question body or don't address the actual problem, please read this simple summary of what you need to know: This is not a "Why won't my default installation of PowerShell run scripts?" question. This is not a "Why won't my installation of PowerShell run scripts downloaded from the internet?" question. The question is why the RemoteSigned execution policy is preventing script execution when it shouldn't.