I need a script that copies an x amount of files and copies them to another folder.
I tried using PowerShell commands, but I can't find a way to add variables that were determined in the batch file.
Is there a way of doing it all in batch?
My code:
@echo off & cd /d "%~dp0"
set /p var1=Enter first dir:
set /p var2=Enter second dir:
set /p num=How many files:
echo %var1%
echo %var2%
echo %num%
powershell -Command "& {ls $env:var1 | Get-Random -Count $env:num | Copy-Item -Destination $env:var2}"
pause
I'm sorry if this is a simple question, but I'm kinda new to batch and still learning.