Recently created a powershell script and tried calling it from windows without admin access and this is the error message
(C:\Anaconda) C:\Anaconda>powershell -File C:\Users\Desktop\calc.ps1
File C:\Users\Desktop\calc.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : SecurityError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess
stumped…thats bad after few google searches and few stack overflow posts, this is the solution that worked for me.
set PWS=powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile
%PWS% -File C:\Users\u8040036\Desktop\calc.ps1
When using python as a driver program to lot of other apps, usage of batch files in windows system is something everyone encounters
And when it comes to batch files, sending command line arguments to batch file is one thing i tend to google a lot. A command line argument (or parameter) is any value passed into a batch script. So for convenience, I am listing the most common usages that I needed last year
%* for all command line parameters (excluding the script name itself).
%0 - the command used to call the batch file (could be foo, ..\foo, c:\bats\foo.bat, etc.)
%1 is the first command line parameter,
%2 is the second command line parameter,
and so on till %9 (and SHIFT can be used for those after the 9th).
%~nx0 - the actual name of the batch file, regardless of calling method (some-batch.bat)
%~dp0 - drive and path to the script (d:\scripts)
%~dpnx0 - is the fully qualified path name of the script (d:\scripts\some-batch.bat)