Batch Programs Thread.

Started by macdad-, June 16, 2008, 06:24:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

macdad-

Ok this continues off of the "i want to make a simple game in dos" thread. if you have some batch programs you would like to share and discuss about just post em in this thread.  :)

Quote from: macdad- on August 05, 2008, 03:56:47 PM
this isnt a help post, its where you post batch programs you've made if you want to share them.
If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.

Carbon Dudeoxide

#1
I made this a while back.


Rock, Paper, Scissors!
@echo off
set tp=star
set uscore=0
set cscore=0
cls
:start
Title Rock paper scissors
COLOR f0
cls
echo.
echo. Computer score = %cscore%
echo. Your score =     %uscore%
echo.
Echo. Pick and type either 'rock' 'paper' or 'scissors' and press Enter
Set /p tp= :
if %tp% equ rock set g=1
if %tp% equ paper set g=2
if %tp% equ scissors set g=3
Set /a Number=(%Random% %%3)+1
If %Number% equ 1 set h=rock
If %Number% equ 2 set h=paper
If %Number% equ 3 set h=scissors
if %h% equ rock set a=1
if %h% equ paper set a=2
if %h% equ scissors set a=3
if %a% equ %g% goto tie
if %a%%g% equ 13 goto lost
if %a%%g% equ 21 goto lost
if %a%%g% equ 32 goto lost
if %a%%g% equ 12 goto winner
if %a%%g% equ 23 goto winner
if %a%%g% equ 31 goto winner
if /i %tp% EQU rosk (
Title WINNER!
set /a uscore=%uscore%+1
cls
echo.
Echo. Your Guess was rock and I picked scissors. That meens you won!
echo.
echo.
pause
goto start
)
if /i %tp%==star goto :wtfno
else (
:wtfno
cls
echo.
echo. You didn't choose anything.
echo.
echo. Please type either 'rock' 'paper' or 'scissors' and
echo. press Enter.
echo.
echo.Press any key to start playing again. . .
pause > nul
goto :start
)

:winner
Title WINNER!
set /a uscore=%uscore%+1
cls
echo.
Echo. Your Guess was %tp% and I picked %h%. That meens you won!
echo.
echo.
pause
goto start

: tie
Title TIE
cls
echo.
Echo. Your Guess was %tp% and I picked %h%. That meens we tied
echo.
echo.
pause
goto start

: lost
Title LOST!
set /a cscore=%cscore%+1
cls
echo.
Echo. You picked %tp% and I picked %H% so I won!
echo.
echo.
pause
goto start

Carbon Dudeoxide

#2
Here's another one. It's pretty fun. Something to do when you're bored.

Play it out to the end. Not that hard.


@echo off
color f0
cls
@echo off
setlocal
title Guessing Game Small Version
:startggs
cls
set /A MyNumber="(%Random% %%1000) + 1"
set /A NumGuess=0
echo You have to guess a number in the range 1 to 1000
echo I will for each guess tell you if the number is to small
echo or to large                  
echo.
:Nextggs
set /P Guess="Enter a number> "
set /A NumGuess+=1
if %Guess% EQU %MyNumber% goto :Winggs
if %Guess% LSS %MyNumber% echo Your number is to small
if %Guess% EQU 815 goto :winggs
if %Guess% GTR %MyNumber% echo Your number is to large
if /I %guess%==back goto :1
if %guess%==back goto :1
goto :Nextggs

:Winggs
echo Congratulations you guessed the numer in %NumGuess% tries
set /P Answer="Do you want to try again [y/n]> "
if [%Answer%]==[y] goto :startggs
if {%Answer%}=={n} goto :1

Carbon Dudeoxide

And this one here:
http://www.computerhope.com/forum/index.php/topic,29824.0.html

That was made by my friends friend (CH Name = Jargee)

He's the one who showed me to ComputerHope.

I like his game though, very entertaining.

macdad-

that seems like a spinoff of my DOS Cards game but its cool. 8)

oh yea i finished my second version of Sys Stat version 2.0.1 with alot
of new features. plz dont copyright!

[recovering disk space -- attachment deleted by admin]
If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.

Carbon Dudeoxide

Not bad. Definitely something I will keep in my Batch folder.   :P

devcom

very old project.it was in old topic but ill post it here

[recovering disk space -- attachment deleted by admin]
Download: Choice.exe

Fen_Li

nice thread.. ;)
i hope moderator stick this thread.. ::)

i also have a program to make Pascal's Triangle :

@echo off
setlocal ENABLEDELAYEDEXPANSION
Title Pascal's Triangle
:Begin
cls
(set n=)
set /p "n=Input (?? Lines) : "
if not defined n goto :Begin
(set /a nspace=n-1)
(set temp_var=!nspace!)
for /L %%a in (1,1,!n!) do (
for /L %%n in (1,1,!nspace!) do (
for /F "Delims=" %%s in ('echo. ') do <nul set /p "=%%s"
)
(set /a nspace-=1)
(set Bil[%%a][1]=1)
(set Bil[%%a][%%a]=1)
if %%a gtr 2 for /L %%x in (2,1,!temp_var!) do (
set /a "prev=%%a-1"
set /a "prev_coloum=%%x-1"
call set "temp_1=%%Bil[!prev!][!prev_coloum!]%%"
call set "temp_2=%%Bil[!prev!][%%x]%%"
set /a "Bil[%%a][%%x]=temp_1+temp_2"
)
for /L %%b in (1,1,%%a) do <nul set /p "=!Bil[%%a][%%b]! "
echo.
)
pause>nul
goto :Begin
:END

try that..
;D
..Still Newbie KID..

devcom

wow i like this one mate ;) i've made sth like this but it make pytagoras trees and count time wich program spend to make them ;)
Download: Choice.exe

Fen_Li

again..
originally from me.. ;D ??? :o

a program called "Process Manager".
like a "Windows task Manager"..


@echo off
mode 33,25
setlocal ENABLEDELAYEDEXPANSION
Title Process Manager
:Begin
CD /D "!TEMP!"
set "TASKLIST=%windir%\system32\tasklist.exe"
set "FIND=%windir%\system32\find.exe"
set "wmic=%windir%\System32\Wbem\wmic.exe"
set "Explore=%windir%\explorer.exe"

:Reload
cls
set num=0
echo.________________________________
echo.[ Process Name ]         [ PID ]
echo.--------------------------------
if not defined NAME set NAME=%USERNAME%
!TASKLIST! /FI "USERNAME eq !NAME!" /FO TABLE /NH >"plist.txt"
for /f "tokens=*" %%a in (plist.txt) do (
set /a num+=1
set "list=%%a"
set "list=!list:~0,32!"
echo.!list!
)
echo.________________________________
Del /f /q "plist.txt" >nul 2>&1
Title !NAME! - [!num!] Process Running.
if not defined ac (
if /i "!NAME!"=="%USERNAME%" goto :USR
if /i "!NAME!"=="SYSTEM" goto :SYS
)
if /i "!ac!"=="K" goto :Kill
if /i "!ac!"=="S" goto :SYSTEM
if /i "!ac!"=="U" goto :USER
if /i "!ac!"=="E" goto :Explore
set "ac="
GOTO :Reload

:USER
set "NAME="
set "ac="
GOTO :Reload
:USR
echo.CH : K=Kill, S=System, E=Explore
set /p "ac=Action : "
GOTO :Reload

:SYSTEM
set NAME=SYSTEM
set "ac="
GOTO :Reload
:SYS
echo.CH : K=Kill, U=User, E=Explore
set /p "ac=Action : "
GOTO :Reload

:Kill
echo.Type PID to Kill..
set "ac="
set /p "PID=PID : "
if not defined PID goto :Reload
Taskkill /F /PID !PID! >nul 2>&1
if errorlevel 1 (echo.No Task Running w/ this PID.) else (
if !PID! geq 0 if !PID! lss 10 (
echo.Can't kill Critical Process
goto :clr_var2
) else (
echo.Success : Task with PID=!PID!
echo.          has been KILLED..
))
:clr_var2
set "ac="
set "PID="
PAUSE>NUL
GOTO :Reload

:Explore
echo.Type PID to Explore..
set "ac="
set /p "PID=PID : "
if not defined PID goto :Reload
if !PID! lss 10 goto :clr_var
if !PID! gtr 10000 goto :clr_var
!wmic! process get ProcessID,ExecutablePath >"path.txt"
for /f "tokens=1,2 delims= " %%a in ('type "path.txt" ^| !FIND! " !PID! "') do (
set "exepath=%%~dpa"
)
if not defined exepath (
echo.No Task Running w/ this PID.
PAUSE>NUL
) else (START !Explore! "!exepath!")
:clr_var
set "PID="
set "exepath="
Del /f /q "path.txt" >nul 2>&1
GOTO :Reload

:END


note : u must RUN under Windows XP Professional (service pack 2 recomended).
..Still Newbie KID..

macdad-

hey devcom i never was able to move the x around in Shoot. could you help me with that?

thanks carbon, i have been working on that for a while and debugged it so thanks for your appreciation. :)
If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.

devcom

explain it more coz i dont know what you mean with 'x'
Download: Choice.exe

Carbon Dudeoxide

Quote from: devcom on June 17, 2008, 05:21:25 AM
explain it more coz i dont know what you mean with 'x'
Where?

macdad-

sorry i meant on that Move game you made
If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.

devcom

well i think you dont have choice.exe becouse it use it to move smother than typeing single letter and press enter.
here is a link to choice.exe
http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html
simply put it to C:\windows\system32
Download: Choice.exe