Wednesday, July 6, 2022

MIND BLOWN: powershell or cmd from window explorer (Windows 10)

MIND BLOWN: A new category to publish something that has been around forever that I have never known and is a life-changer for me.


HISTORY: For a long, long, long time... I have always dreaded using cmd, CLI, powershell, etc. because I just hated having to navigate to the folder. I have only known to open it from the run command or some shortcut. It is not bad if I can manage my folders because I keep it short and simple. Other people always seem to have deep folder structures, spaces, special characters, etc.


SUMMARY: I can just type powershell or cmd in the address bar (ALT+D), and it'll open to the directory the windows explorer is open to.

I don't know when this started and I don't care because I rarely ever have to go to an older version of Windows and Windows 10 has been around for some time now. But this is so mind-blowing for me. Because I can tell you that every time I had to use powershell, I always, ALWAYS right-click in the window in hopes that an option would appear for me. There is the Run Powershell, but that doesn't accept user prompts (or at least I have never figured out how to get that to work as I don't work with PS on a daily basis or even yearly basis). But now that I have been tasked to build DevOps pipelines, I am finally forced to learn this stuff.


Additional Notes: Found the reason, right-click does not work is because the script was throwing an error:

File C:\test.ps1 cannot be loaded. The file C:\test.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

To resolve this, I had to run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

After this, I was able to right-click and execute it.


Alternative: I can also just go to file and open with mouse clicks. 

 

No comments:

Post a Comment