-3

I am a really noob when it comes to this kind off stuff. I hope I can ask this question here.

I have a text file containing 200 names of zip files and a folder containing 4000 zip files.

Is there a way to read the .txt and copy the 200 .zip files?

I searched and came up with this:

$Files = Get-Content filename.txt
$Dest = "PathTo:\Desired\Folder"

foreach ($File in $Files) {
  Copy-Item $File $Dest
}

This is PowerShell, so I tried that, but I don't have permission or something. So is there a .bat someone knows?

7
  • 2
    No one can help you, we need more information. Whats the error message. Whats the value of $file? Mar 15, 2018 at 13:39
  • @guiwhatsthat it's actually clear, the person wants the batch code (even though I don't think it's going to help that much) Mar 15, 2018 at 16:56
  • @HackerNCoder SO is not a code writing service. Its here to solve problems Mar 15, 2018 at 17:08
  • @guiwhatsthat, I do know that, but how else would you do it? Mar 15, 2018 at 17:10
  • @HackerNCoder He should give more information about the real probelm. We don't even know the error message Mar 15, 2018 at 17:14

1 Answer 1

1

Here's the batch code:

for /F "tokens=*" %%A IN (myfile.txt) DO (
copy %%A insertDesiredFolder
)

that should work if I'm correct, else take a look here:

For command

Copy command

1
  • @user3854300 no problem, I'm here to help Mar 15, 2018 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.