Home / Microsoft / Microsoft DOS / Batch Programs Thread.
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 ... 37 - (Bottom) Print
Author Topic: Batch Programs Thread.  (Read 96225 times)
macdad-
Topic Starter
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« on: June 16, 2008, 06:24:50 AM »

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.  :)

this isnt a help post, its where you post batch programs you've made if you want to share them.
« Last Edit: December 08, 2008, 09:25:33 PM by Carbon Dudeoxide » IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Carbon Dudeoxide
Global Moderator
Mastermind


Thanked: 145
Posts: 16,077

Certifications: List
Computer: Specs
Experience: Expert
OS: Mac OS


Carbon - The building block of life on Earth.

My Youtube Profile 1 1
« Reply #1 on: June 16, 2008, 06:28:00 AM »

I made this a while back.

Code: [Select]
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
« Last Edit: June 17, 2010, 06:54:36 AM by Carbon Dudeoxide » IP logged

Carbon Dudeoxide
Global Moderator
Mastermind


Thanked: 145
Posts: 16,077

Certifications: List
Computer: Specs
Experience: Expert
OS: Mac OS


Carbon - The building block of life on Earth.

My Youtube Profile 1 1
« Reply #2 on: June 16, 2008, 06:31:06 AM »

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

Play it out to the end. Not that hard.

Code: [Select]
@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
« Last Edit: June 17, 2010, 06:54:22 AM by Carbon Dudeoxide » IP logged

Carbon Dudeoxide
Global Moderator
Mastermind


Thanked: 145
Posts: 16,077

Certifications: List
Computer: Specs
Experience: Expert
OS: Mac OS


Carbon - The building block of life on Earth.

My Youtube Profile 1 1
« Reply #3 on: June 16, 2008, 06:33:59 AM »

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.
IP logged

macdad-
Topic Starter
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #4 on: June 16, 2008, 06:35:57 AM »

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]
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Carbon Dudeoxide
Global Moderator
Mastermind


Thanked: 145
Posts: 16,077

Certifications: List
Computer: Specs
Experience: Expert
OS: Mac OS


Carbon - The building block of life on Earth.

My Youtube Profile 1 1
« Reply #5 on: June 16, 2008, 06:40:06 AM »

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

devcom
Apprentice



Thanked: 37
Posts: 521


« Reply #6 on: June 16, 2008, 07:29:22 AM »

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

[recovering disk space -- attachment deleted by admin]
IP logged

Download: Choice.exe
Fen_Li
Beginner



Thanked: 2
Posts: 62

G-Smart thing Smart

« Reply #7 on: June 16, 2008, 12:42:38 PM »

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

i also have a program to make Pascal's Triangle :
Code: [Select]
@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
IP logged

..Still Newbie KID..
devcom
Apprentice



Thanked: 37
Posts: 521


« Reply #8 on: June 16, 2008, 01:01:49 PM »

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 ;)
IP logged

Download: Choice.exe
Fen_Li
Beginner



Thanked: 2
Posts: 62

G-Smart thing Smart

« Reply #9 on: June 16, 2008, 01:15:59 PM »

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

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

Code: [Select]
@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).
IP logged

..Still Newbie KID..
macdad-
Topic Starter
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #10 on: June 16, 2008, 03:47:38 PM »

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. :)
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
devcom
Apprentice



Thanked: 37
Posts: 521


« Reply #11 on: June 17, 2008, 05:21:25 AM »

explain it more coz i dont know what you mean with 'x'
IP logged

Download: Choice.exe
Carbon Dudeoxide
Global Moderator
Mastermind


Thanked: 145
Posts: 16,077

Certifications: List
Computer: Specs
Experience: Expert
OS: Mac OS


Carbon - The building block of life on Earth.

My Youtube Profile 1 1
« Reply #12 on: June 17, 2008, 05:25:05 AM »

explain it more coz i dont know what you mean with 'x'
Where?
IP logged

macdad-
Topic Starter
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #13 on: June 17, 2008, 06:57:07 AM »

sorry i meant on that Move game you made
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
devcom
Apprentice



Thanked: 37
Posts: 521


« Reply #14 on: June 17, 2008, 07:11:39 AM »

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
IP logged

Download: Choice.exe
Pages: [1] 2 3 ... 37 - (Top) Print 
Home / Microsoft / Microsoft DOS / Batch Programs Thread. « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.095 seconds with 21 queries.