Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 186133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:35:36+00:00 2026-05-11T15:35:36+00:00

I made a Powershell function just now and saved it to a ps1 file.

  • 0

I made a Powershell function just now and saved it to a ps1 file. However, when I try to execute it from within powershell, it won’t run.

I’ve allready changed to the settings for running unsigned code by entering this command:

set-executionpolicy remotesigned 

The function is this:

Function listAllPaths([string]$fromFolder, [string]$filter, [string]$printfile){ Get-ChildItem -Path $fromFolder -Include $filter -Recurse -Force -Name > $printfile } 

What it does is create a textfile in which all the path’s to a certain file are listed.
I’ve put it directly under c:\ and named the file listAllPaths, same as the function.

When I enter the following command inside Powershell:

PS> listAllPaths.ps1 c:\ *.pdf testingPDF.txt 

I get an error saying:

The term ‘listAllPaths.ps1’ is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.

I’ve tried several things and I honestly don’t know how to get this to work? What I expect is for a file to be created on the given path, c:\ in this example. That file having the name testingPDF.txt and the contents being the generated this.

Can someone tell me what I’m forgetting here.

And no, Google doesn’t answer everything. Tried that one allready. I wouldn’t come and ask it here if I hadn’t allready tried the online search-engines.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:35:37+00:00Added an answer on May 11, 2026 at 3:35 pm

    This is a typical error across many platforms where your environment path does not include your current directory. so when you execute your script (or command or program etc), your runtime environment looks everywhere except your current/working directory.

    Try

    PS> .\listAllPaths.ps1 c:\ *.pdf testingPDF.txt 

    EDIT: After reading your comments, I’m going to suggest you try this. I haven’t actually verified the logic of your PS script. I’m merely trying to get your script to execute first.

    Try editing your script as below, and execute as above.

    Function listAllPaths([string]$fromFolder, [string]$filter, [string]$printfile){ Get-ChildItem -Path $fromFolder -Include $filter -Recurse -Force -Name > $printfile }  listAllPaths 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 217k
  • Answers 217k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Solution: Man, this was a weird one. The problem was… May 12, 2026 at 11:19 pm
  • Editorial Team
    Editorial Team added an answer Current solution: YYYY/MM/DD+YY/MM/DD+DOW all blocks (delimited by +) are optional… May 12, 2026 at 11:19 pm
  • Editorial Team
    Editorial Team added an answer Since the solution language was not specified, Python is used… May 12, 2026 at 11:19 pm

Related Questions

I found this function in my old powershell folder: Function listAllPaths([string]$fromFolder,[string]$filter) { Get-ChildItem -Path
Our company has a policy imposing the requirement of keeping source code in a
Microsoft appears to be moving a lot of configuration and query capabilities to PowerShell
I have a simple PowerShell script that uses WMI to create a web site

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.