Batch file to pull a random string from a file and loop a random number of times
Date : March 29 2020, 07:55 AM
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: @echo off
setlocal
set "file=c:\myfile.txt"
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
exit /b
: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 (
echo %%A
exit /b
)
|
A batch file that search for a file, rename file and move it to another directory
Date : March 29 2020, 07:55 AM
With these it helps , Perhaps you can try this code: set CURR_DATE=%DATE%
set MONTH=%CURR_DATE:~4,2%
set DAY=%CURR_DATE:~7,2%
set YEAR=%CURR_DATE:~12,2%
set VERSION=%YEAR%%MONTH%%DAY%
set source_folder = "C:\source"
set dest_folder = "C:\dest"
cd %source_folder%
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
Date : March 29 2020, 07:55 AM
hope this fix your issue I have a batch file, and I want the output of it (txt) uploaded to my FTP server. , Start by saving the filename in a variable, as so: set FILENAME=C:\Users\Public\Folder\%RANDOM%%RANDOM%%RANDOM%.txt
|
Batch file set to pick a random file from preset categories is not picking a random file (keeps picking the last file!)
Date : March 29 2020, 07:55 AM
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
Date : March 29 2020, 07:55 AM
|