I need a batch script to randomly select X number of files in a folder and move them to another folder. How do I write a windows batch script that can do this?
(I'm assuming that your X is known beforehand – represented by the variable $x in the following code).
Since you weren't adverse to a PowerShell solution:
Get-ChildItem SomeFolder | Get-Random -Count $x | Move-Item -Destination SomeOtherFolder
or shorter:
gci somefolder | random -c $x | mi -dest someotherfolder