1

Ok... so I'm almost 100% sure I had this working on my previous computer but I can't remember how to accomplish it now. I have a list of many custom scripts I've created and I place them in the c:\Users\myuser\Documents\WindowsPowerShell\Scripts\ folder. I want to be able to, from any directory, call up a script that is in that folder and run it. For example: a script with the name "FindUser.ps1" which basically queries AD for a name that contains "xyz". I should be able to start typing "FindU" and then push the TAB button and it should autocomplete to FindUser.ps1 no matter if i'm in the directory where the script is located in. shouldn't anything in that scripts folder auto complete by default? any help would be much appreciated. Thanks in advance.

1
  • Is the script folder in your PATH? Jul 29, 2019 at 18:09

2 Answers 2

0

Change the scripts to functions and put them in a module. Put it in the module folder Import the module or Dot Source the file. If you do this, then it's accessible in your sessions, and discoverable via the normal PowerShell paths lookups.

0

Ok.... so my bad... I had this C:\Users\\Documents\WindowsPowerShell and not the actual path to the scripts

C:\Users\\Documents\WindowsPowerShell\Scripts

looks to be working now. so that's the answer... add the directory to your path environment variable.

Thanks!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .