Forum Discussion

Marc__VB's avatar
Marc__VB
Copper Contributor
Jun 22, 2022
Solved

Copying files in powershell

Hi,   I just start working with powershell and I'm already blocked with my first script.   I want of copy a file from one location to another and the name of the file is in a variable. I use the ...
  • LainRobertson's avatar
    Jun 22, 2022

    Marc__VB 

     

    Hi, Marc.

     

    To "break out" of the string mode and parse $a as a variable, you can use the following PowerShell construct:

     

    $(<PowerShell code and variables go in between, in here>)

     

    So, that would make a slight change to your command to the following:

    Copy-Item -Path "D:\PowerShell\Basis_Rappel_Folder\$($a[$i].Pdfbestand)" -Destination D:\PowerShell\Prog_Data\Output\Email\

     

    Cheers,

    Lain

Resources