I Need Some Powershell Education

Page 1 of 3 123 LastLast

  1. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
       #1

    I Need Some Powershell Education


    Since the days of an Autoexec.Bat and the Config.Sys, I've kept a directory/folder named Utilities for Batch Files and small programs that do not require installation. It's always been on "the path" for obvious reasons. With the coming of CU and Powershell replacing the Command Prompt, I've been learning something about PS. It's been said that anything I can do from the Command Prompt, I can do in PS. Well I must have something wrong. Here's my setup now and none of my Batch Files or "little" programs run in PS:

    I Need Some Powershell Education-1-capture.png

    I Need Some Powershell Education-2-capture.png

    How do I get the Utilities folder in a path that PS will read?

    Thanks for any attention and help.
      My Computer


  2. Posts : 15,037
    Windows 10 IoT
       #2

    This may or may not help but command prompt is till there. Settings > Personalization > Taskbar > Replace Command prompt with Power shell in the menu when I right click the start button. Set to Off to get the command prompt option.
      My Computer


  3. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
    Thread Starter
       #3

    Hey, thanks for the comment. It is appreciated. I understand. I'm just trying to learn the coming changes and adapt to them. I do know "cmd" will still be available to be run from Powershell.
      My Computer


  4. Posts : 15,037
    Windows 10 IoT
       #4

    I had a feeling you'd say that. :) I'm a total powershell noob. So much so that I switch it back to command prompt out of habit.
      My Computer


  5. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
    Thread Starter
       #5

    So you know how I feel.
      My Computer


  6. Posts : 8,101
    windows 10
       #6

    Tons of tutors on YouTube for PowerShell
      My Computer


  7. Posts : 3,257
    Windows 10 Pro
       #7

    CWGilley said:
    Hey, thanks for the comment. It is appreciated. I understand. I'm just trying to learn the coming changes and adapt to them. I do know "cmd" will still be available to be run from Powershell.
    You appear to have misunderstood what I said earlier. CMD shell is not going away. The only thing that's gone away is the "Open CMD shell" from the file menu of File Explorer. CMD is still in the start menu, and you do not have to run it from within powershell.

    The point I was making was that you could click File->Open Windows Powershell and then do many of the common things, or run cmd from within powershell. You can still run a standard cmd console by going to start and typing cmd and a regular cmd prompt will open. You can also pin that to start or taskbar if you want.

    In any event, after you add a path to your environment variables, you have to start a new console or powershell window.
      My Computer


  8. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
    Thread Starter
       #8

    Ah, I did misunderstand that one. You shouldn't scare old people like that.

    Mystere said:
    ...In any event, after you add a path to your environment variables, you have to start a new console or powershell window.
    Hmmm. That path addition has been in place since right after I first booted this machine up.

    Humph! Something else I have to deal with. But I do have to admit it's entertaining and sometimes even a little fun.
      My Computer


  9. Posts : 93
    Windows 10
       #9

    CWGilley said:
    It's been said that anything I can do from the Command Prompt, I can do in PS. Well I must have something wrong. Here's my setup now and none of my Batch Files or "little" programs run in PS:\
    ...
    How do I get the Utilities folder in a path that PS will read?
    CWGilley, could you elaborate?

    If I have a folder “C:\Utilities” in the path variable with batch and powershell scripts in it, I can specify just the name of the batch or powershell script in a powershell console and it will run. Is this what isn’t working for you?
      My Computer


  10. Posts : 3
    W10 Pro 1703
       #10

    SET PATH=C:\Utility;%PATH% should just work fine ( or using the GUI as you showed)
    Another trick is to always have your script go to the working directory, in my view mandatory ( did that also with Batch):
    $location = Split-Path ((Get-Variable MyInvocation -Scope 0).Value).MyCommand.Path
    Push-Location $location
    [Environment]::CurrentDirectory = $location
    <scriptcode>
    Pop-Location (if you have more lines below, make sure you are where you expect it.)

    Calling for scripts or apps, please read PowerShell and external commands done right // blog.edgylogic
    That one helped me A LOT!!!

    in my view ( and with the Batch experience of an old guy), Batch can do stuff with less code, normal OS things. But with conditions, functions (as we call them Procedures) and working with file-content, apps, Registry and what have you, I believe one has to start PS. So, chapeau for going there. There are indeed tons of info, have fun
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:07.
Find Us




Windows 10 Forums