Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to move multiple selected files in powershell via $variable

Tags:

powershell

I was looking for way to move multiple files from one directory into the other using powershell variables.

Lets say I have var $domain = test.test and I have four files in directory $domain.csr $domain.crt $domain.pfx $domain.key". I can't seem to be able to do it this way Move-Items "$domain.csr $domain.crt $domain.pfx $domain.key" ../certs Is there a one line comand to perform that?

Thanks.

like image 717
Andrius Solopovas Avatar asked Sep 20 '25 10:09

Andrius Solopovas


1 Answers

You have to pass the source path as a <String[]>, so try:

Move-Item -Path $domain.csr, $domain.crt, $domain.pfx, $domain.key -Destination ../certs
like image 183
sheldonzy Avatar answered Sep 23 '25 07:09

sheldonzy