Save and Load .bat game

You could also save/load with only values, like ( echo %highscore% echo %playername% echo %points% ) > savegame.sav and load them with < savegame.sav ( set /p highscore= set /p playername= set /p points= ) The first part simply redirects the echo outputs to a file. The loading part using also file redirection, but in … Read more

delay a batch file in under a second?

Some time ago I posted a method that gives precise timing with delay intervals from 15 milliseconds on. This is a copy of the entire post. I think I achieved a milliseconds delay with precise timing when the delay is small. I used an hybrid Batch-JScript solution with WScript.Sleep method, but in order to avoid … Read more

Batch – Converting variable to uppercase

The shortest way (without requiring 3rd party downloads) would be to use PowerShell. set “str=The quick brown fox” for /f “usebackq delims=” %%I in (`powershell “\”%str%\”.toUpper()”`) do set “upper=%%~I” A faster way but still using less code than any pure batch solution would be to employ WSH. @if (@CodeSection == @Batch) @then @echo off & … Read more

batch file to delete files older than a specified date [duplicate]

I use this script: //////////////////////////////////////////////////////// // Deletes file older than a number of days // in the current directory //////////////////////////////////////////////////////// // Usage: wscript DeleteOlderThan.js [#Days] // By default, remove files older than 30 days //////////////////////////////////////////////////////// function removeDays(date, nDays) { var dateRet = date return dateRet.setDate(date.getDate() – nDays); } function addSlash(strPath) { var c = strPath.substr(-1, … Read more