@echo off & setLocal enableDELAYedeXpansioN
:start
set E=
for /f "tokens=* delims= " %%h in ('dir/b') do (
set /a E+=1
)
set /a F = !random! %% E + 1set G=
for /f "tokens=* delims= " %%h in ('dir/b') do (
set /a G+=1
if !F! equ !G! (copy /y "%%h" "c:\users\user1\My Documents\VirtualDJ\Sampler\sample3.*")
)
timeout 5
goto startIn the above batch file I would like to copy file from a different folder other than the folder where the batch file is. How would I specify the folder to copy from ?.
use %1 while initiallising the batch command. something like this if you batch file name aaa.bat
aaa.bat abc1 abc2
where aaa.bnat will be like this
copy %1 %2 ( Note - %1 =abc1 , %2 =abc2 )
Hope this resolves.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |