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

  • SEARCH
  • Home
  • 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 8832991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:40:15+00:00 2026-06-14T08:40:15+00:00

My source files all reside in one folder whose path is contained in a

  • 0

My source files all reside in one folder whose path is contained in a variable named $template.
I need to specify the exact filename as each file goes to a different destination.

My goal is to merely concatenate the filename to the variable.

Example:

$template = "D:\source\templatefiles\"

Filename1 is: “graphic-183.jpg”

I have tried:

Join-Path $template graphic-183.jpg

Issuing this at the cli appears to do what I want.

But now, how do I reference this concatenated file path short of creating a new variable for each file? It isn’t as simple as for-nexting my way through a list as depending on the filename that determines where the file goes.

I am toying with case else, elseIf, but surely it isn’t this hard.

The bottom line is, I just want to prefix the folder path to each filename and hard code the destination as it will always be the same each time the script is run.


edit

I just edited this as I forgot to mention how I am trying to use this.

In my script I intend to have lines like:

Copy-Item -Path $template filename.ext -Destination $destfolder

It’s the highlighted part above that I am trying to join $template to the filename.

Thanks for any advice.

-= Bruce D. Meyer

  • 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. Editorial Team
    Editorial Team
    2026-06-14T08:40:16+00:00Added an answer on June 14, 2026 at 8:40 am

    maybe this is what you want?

    you can call cmdlets in place, using parentheses, like so:

    Copy-Item -Path (Join-Path $template filename.ext) -Destination $destfolder
    

    this causes PowerShell to go from “argument mode” to “expression mode” – i.e., it returns the output of the Join-Path cmdlet as an expression.

    and yes, David’s and Ansgar’s suggestions are also helpful – try this to get full paths only:

    (get-childitem $template) | select fullname
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My source files are in this folder: c:\data\mycompany. All of my source files contain
All source files seem to have compiled fine. However, since I achieved that, I
// // Prefix header for all source files of the 'Bar_scan' target in the
How can I get GDB to print all the source files that it recognises?
I would like to run JSHint on all my Javascript source files but several
I know how to generate my Localizable.strings file from all the source (*.m) files
I've always backed up all my source codes into .zip files and put it
I am trying to copy all format file (.txt,.pdf,.doc ...) file from source folder
How would one go best about checking for existence of all files before building?
I'm debugging a set of C source files using GDB. I've compile all the

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.