Batch - Scripting - Sample Programs

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

SAMPLE PROGRAMS

BATCH SCRIPTING
NAMING VARIABLES

@echo off
title Variables
set name=Rizza
echo What is your name?
set /p name=
echo Your name is %name%
USER INPUT pause
@echo off
title User Input
echo Press 1 to make me say "Hi"
echo Press 2 to make me say "Bye"
set /p block=
if %block%==1 goto hi
if %block%==2 goto bye
:hi
echo Hi
pause
::exit
:bye
echo Bye
pause
::exit

USER INPUT
CREATING DIRECTORS, DELETING AND RENAMING COMMAND

@echo off
title Directors, Delete command and Rename Command
echo Hello! >hello.txt
::ren C:\Users\rizza\Desktop\\hello.txt hello1.txt
::del C:\Users\rizza\Desktop\\hello.txt

USER INPUT

You might also like