Technology

Tag Archives

Archive of posts published in the category: awesome
Apr
7

post your awesome batch files! – Programming

@echo off
color 2e
title CMD Snake Game    -Aaron
if “%~1” == “startGame” goto :game
if “%~1” == “startController” goto :controller

set “choice=”
2>nul >nul choice /c:yn /t 0 /d y
if errorlevel 1 if not errorlevel 2 set “choice=choice /cs”
if not defined choice (
  2>nul >nul choice /c:yn /t:y,1
  if errorlevel 1 if not errorlevel 2 set “choice=choice /s”
)
if not defined choice (
  echo ERROR: This game requires the CHOICE command, but it is missing.
  echo Game aborted. :(
  echo(
  echo A 16 bit port of CHOICE.EXE from FREEDOS is available at
  echo http://winsupport.org/utilities/freedos-choice.html
  echo(
  echo A 32 bit version from ??? suitable for 64 bit machines is available at
  echo http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html
  echo(
  exit /b
)


set “keys=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”
set “keyFile=key.txt”
set “cmdFile=cmd.txt”
set “highscoreFile=last score on !difficulty!.txt”


copy nul “%keyFile%” >nul
start “” /b “%~f0” startController 9^>^>%keyFile% 2^>nul ^>nul
cmd /c “%~f0” startGame 9^<%keyFile% ^<nul
echo(

:close

Read More