Forum Discussion
Marc__VB
Jun 22, 2022Copper Contributor
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 ...
- Jun 22, 2022
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
LainRobertson
Jun 22, 2022Silver Contributor
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
- Marc__VBJun 23, 2022Copper Contributor
Hello Lain,
Many Thanks for your replay. Now, with your advice my script works perfect.
Problem solved !
ps. this was a construction I didn't know.
kind regards,
marc