To set the ExecutionPolicy using Powershell, run Powershell as Administrator.
Type in Set-ExecutionPolicy followed by the ExecutionPolicy you wish to use.
Microsoft has disabled scripting by default to prevent malicious code from being executed.
To set the ExecutionPolicy using Powershell, run Powershell as Administrator.
Type in Set-ExecutionPolicy followed by the ExecutionPolicy you wish to use.
Microsoft has disabled scripting by default to prevent malicious code from being executed.
To check if a number is a power of 2 in C# and VB.NET you can use the following extension method.
public static bool IsPowerOfTwo(this ulong input) { return (input != 0) && ((input & (input - 1)) == 0); }
<System.Runtime.CompilerServices.Extension> _ Public Shared Function IsPowerOfTwo(input As ULong) As Boolean Return (input <> 0) AndAlso ((input And (input - 1)) = 0) End Function
As always, the extension method was added to out Fesslersoft.Extensions library @Github
To check if file or folder exists in Powershell you can use the following snippet.
if(test-path "C:\Users\Codesnippets\Desktop\Test.xml") { echo "exists!" } else { echo "not exists!" }
if(test-path "C:\Users\Codesnippets\Desktop") { echo "exists!" } else { echo "not exists!" }