seems to work fine I am trying to create a batch file that will loop a random number of times between 2 and 10 and pull a random line from a text file each time and display it. , You have a few problems:
for /f %%N in ('findstr "." "%file%"^|find /c /v ""') do set lines=%%N
set /a "iterations=%random% %% 8 + 2"
for /l %%N in (1 1 %iterations%) do call :printRandomLine
set /a "skip=%random% %% %lines%"
if %skip% lss 1 (set "skip=") else set "skip=skip^=%skip%"
for /f usebackq^ %skip%^ delims^=^ eol^= %%A in ("%file%") do (
A batch file that search for a file, rename file and move it to another directory
With these it helps , Perhaps you can try this code:
set source_folder = "C:\source"
set dest_folder = "C:\dest"
if exist "%source_folder%\E2F.csv" (
echo "File Exists, Renaming and copying now"
move %source_folder%\E2F.csv %dest_folder%\E2F%VERSION%.csv
) else (
echo "File Not Found"
Upload text file to FTP in batch file, which has random generated file name
This might help you Good evening. I enjoy modding a game in my free time, it's one those games where individual mods are packed into zip files and loaded in by simply placing said zips into a certain folder. I have hundreds of these zips and was hoping to make a batch that would pick out a random mod for me each time I use it instead of having to pick through them all myself, while placing all the unused ones into a disabled folder that I made to keep everything not being used all in one place. Every mod was prefixed with a name referring to what category it'd belong to, for example 'weapon_shotgun_GiantAngryGun9000.zip' or 'character_huck_Clown.zip'
windows batch file script to pick random files from a folder and move them to another folder