Sunday, 2 August 2020

HOW TO BACKUP YOUR ALL DIRECTORY IN YOUR COMPUTER AND FILE NAMES:-

HOW TO BACKUP YOUR ALL DIRECTORY IN YOUR COMPUTER AND FILE NAMES:-

 Syntax 
  
  tree  /f

Description:-

Displays names of files in a directory, subdirectory files 

Example:-

tree  /f    >   c:\main\files.txt

/f = list all files in directory and sub directory.

> Re-direct all diretory and subdirectory files to "files.txt"
open  in notepad and check directory tree.

Sample Programme:-

@echo off

:: useful to take backup how many directory present in your computer 
:: useful to take number of files names present in your computer

c:\bat\ tree /f > test.txt :: to creat file and store
or
c:\bat\ tree /f >> test.txt

::display all directory and filenames after c:\bat directory
exit
-----------------------

How to trace remote computer using IP address or web URL:-

How to trace remote computer using IP address
or web URL:-

 Syntax 
  
  tracert  /d

Description:-

Determines the path taken to a destination by sending Internet Control Message Protocol (ICMP) echo Request  

What is the use of trace root :-

How to Use the Traceroute Command. Traceroute is a command which can show you the path a packet of information takes from your computer to one you specify. It will list all the routers it passes through until it reaches its destination, or fails to and is discarded.

d/     =   Prevents tracert from attempting to resolve the IP addresses of intermediate routers to their names. This can speed up the display of tracert results.

For more detail parameters  c:\windows\system,32\tracert/? 

Example:-

To trace the path to the host named corp7.microsoft.com, type:
tracert corp7.microsoft.com

Sample programmes:-

If you want to tracert for multiple remote computer then you can put it in
batch file.

Run this syntax in Dos command 

tracert google.com  

or   

tracert  typeIP address here

google IP address or URL is 8.8.8.8.8.8.

Is it legal to ping website:- 1 ping is absolutely legal. 100,000 at once and you might get in trouble.

Note:- It will list all the routers (from your computer to remote computer,)
it passes through until it reaches its destination, 

tracert /j 10.12.0.1 10.29.3.1 10.1.44.1 corp7.microsoft.com

How to run programmes at specific time and close programmes at specific time:- How to check performance of monitor:-

How to run programmes at specific time and close programmes at specific time:-
How to check performance of monitor:-

 Syntax 
  
  schtasks    

Description:-

Schedules commands and programs to run periodically or  at a specific time. 
Adds and removes tasks from the schedule.

Schedule Task used to RUN  a programme at perticular given time  time.
or
Schedule task can be used for remainder by creating message box 

I used schedule task for remainder more than 20 programmes to run automaticaly and 20 remainder alert messages .

Examples 1:-

Schedules commands and programs to run periodically at a specific time. 

---------------------
 How to make schedule task, external Link given below:-



Task Scheduler
https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-task-scheduler


Task Scheduler for developers
https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page

---------------------
You can use the Task Scheduler to execute tasks such as starting an application, sending an email message, or showing a message box. Tasks can be scheduled to execute in response to these events, or triggers.
  • When a specific system event occurs.
  • At a specific time.
  • At a specific time on a daily schedule.
  • At a specific time on a weekly schedule.
  • At a specific time on a monthly schedule.
  • At a specific time on a monthly day-of-week schedule.
  • When the computer enters an idle state.
  • When the task is registered.
  • When the system is booted.
  • When a user logs on.
  • When a Terminal Server session changes state.
Sample Programme:-

@echo off
:: open following exe file  schedule task

C:\Windows\System32\Eventvwr.exe

 C:\Windows\System32\Perfmon.exe

How to scan system files and replace correct one:-

How to scan system files and replace correct one:-

 Syntax 
  
  sfc   

Description:-
 
Importent dos commands -- System File checker.......
Scans and verifies the integrity of all protected system files and replaces incorrect versions files with correct versions files.

Examples 1:-

System File checker.......
sfc [/scannow] [/verifyonly] [/scanfile=<file>] [/verifyfile=<file>] 
[/offwindir=<offline windows directory> /offbootdir=<offline boot directory>]

Specified full path and filename before typing command:-

sfc /scannow ( Scans the integrity of all protected system files and repairs files with problems when possible.)
sfc /verifyonly Scans integrity of all protected system files. No repair operation is performed.
sfc /scanfile Scans integrity of the specified file and repairs the file if problems are detected, when possible.
sfc /verifyfile verifies the integrity of the specified file. No repair operation is performed.
sfc /offwindir Specifies the location of the offline windows directory, for offline repair.
sfc /offbootdir Specifies the location of the offline boot directory for offline

Sample programme for System File checker.......:-

type the individual command in dos prompt

How to know your system information:-


How to know your system information:-

 Syntax 
  
  systeminfo    

Description:-

Displays detailed configuration information about a your computer and
 its working operating system , including os-configuration,
 security information, product ID, and hardware properties
 (such as RAM, disk space, and network cards).

Examples 1:-

To view configuration information for a computer named Srvmain, type: systeminfo /s srvmain To remotely view configuration information for a computer named Srvmain2 that is located on the Maindom domain, type

 systeminfo /s    this will give information about computer

 systeminfo /s typecomputername /u domainname-with path use \ slash

To remotely view configuration information (in list format) for a computer named Srvmain2 that is located on the Maindom domain, type:

Sample programme:-

@echo off
:: store system information fo test.txt

systeminfo   >>    c:\main\test.txt

notepad.exe c:\main\test.txt

:: put the output display to test.txt and open  notepad automaticaly.

:end
More Parameters and detail description goto c:\windows\system32\systeminfo/?

Friday, 31 July 2020

3 -- BATCH SCRIPT PROGRAMMING MORE EXAMPLES PAGE 03 -

PAGE 03

BATCH SCRIPT PROGRAMMING 2020 

-------------------------------------------------
Sample programme for understanding syntax concept Just copied as it is:- 


Automatic zipping files and copied to different directory.
Do not copy and run the programme, just understand the concept of programme.
Dos command for ziping and unziping files
pkunzipn.exe and pkzip.exe -- download these two software from internet.
you have to down load both pkzip and pkunzip for windows 64 bit.
or 7-zip application. Link given here.


https://www.7-zip.org/


@echo onif "%1" == "" goto end
if "%2" == "" goto end
if "%3" == "" goto end


if exist f:\times\btimes\btcity\%3*_bgt_mpr_01*.qxd goto btpg2
if not exist f:\times\btimes\btcity\%3*_bgt_mpr_01*.qxd goto btend
:btpg2
if exist f:\times\btimes\btcity\%3*_bgt_mpr_02*.qxd goto bt1
if not exist f:\times\btimes\btcity\%3*_bgt_mpr_02*.qxd goto bt2msg

:bt2msg
p:\bat\notepad.exe bt2msg.txt

goto btend
:bt1
if exist f:\times\btimes\btcity\%3btimes*.zip goto btend
if not exist f:\times\btimes\btcity\%3btimes*.zip goto zip1
:zip1
xcopy f:\times\btimes\btcity\*.zip f:\times\btimes\btcity\backup /m
echo y| del f:\times\btimes\btcity\*.zip

pkzipn c:\main\%3btimes f:\times\btimes\btcity\*.*
sleep 10 bt ziping
rem echo y|xcopy c:\main\%3btimes*.zip f:\times\btimes\btzip /m
move c:\main\%3btimes*.zip f:\times\btimes\btcity
del c:\main\%1btimes*.zip
if exist f:\times\btimes\btcity\%3btimes*.zip goto btmove
if not exist f:\times\btimes\btcity\%3btimes*.zip goto btend
:btmove
move f:\times\btimes\btcity\*.eps f:\times\btimes\btcity\backup
move f:\times\btimes\btcity\*.qxd f:\times\btimes\btcity\backup
move f:\times\btimes\btcity\*.tif f:\times\btimes\btcity\backup
move f:\times\btimes\btcity\*.xtg f:\times\btimes\btcity\backup
del f:\times\btimes\btcity\*.eps
del f:\times\btimes\btcity\*.qxd
del f:\times\btimes\btcity\*.tif
del f:\times\btimes\btcity\*.xtg

if exist f:\times\btimes\btcity\%3btimes*zip goto msg1
if not exist f:\times\btimes\btcity\%3btimes*zip goto btend
:msg1
@echo "btfiles zipped and sent" > f:\news\btimes.snt
dir f:\times\btimes\btcity\*.zip >> f:\news\btimes.snt
pkunzipn f:\times\btimes\btcity\%3btimes*.zip -v *.qxd >> f:\news\btimes.snt
dir f:\times\btimes\btcity\backup\*.qxd >> f:\news\btimes.snt
:btend
rem bangalore times *********************************end
:end
@echo 1 = today date, 2= day 3=tomorrow date
:etp1
@echo Page one not present

:end

-----------------------------------------------
Do not copy and run the programme, just understand the concept of programme.
Sample programme for understanding syntax concept:


Listing different directory and storing it in one place. To check File received Time.
Note that how I used directory in this file.

if "%1"== "" goto end
if "%2"== "" goto end

m:
cd\olivetoi\ban
dir \\PUB-OPI\PUBS\TOI\COLOUR\OUT\%2*toibg*_mpr_*_m_*.ps > f:\news\main\stamp\%2toimet
dir \\PUB-OPI\PUBS\TOI\BW\OUT\%2*toibg*_mpr_*_m_*.ps >> f:\news\main\stamp\%2toimet
echo --------------------------------- >> f:\news\main\stamp\%2toimet
dir k:\pageout\blr\out\%2*toibg*_m_*.pdf >> f:\news\main\stamp\%2toimet
m:
cd\olivetoi\mys
dir \\PUB-OPI\PUBS\TOI\BW\OUT\%2*mys*_*.ps > f:\news\main\stamp\%2toimys
dir \\PUB-OPI\PUBS\TOI\COLOUR\OUT\%2*MYS*.ps >> f:\news\main\stamp\%2toimys
echo --------------------------------- >> f:\news\main\stamp\%2toimys
dir k:\pageout\mys\out\%2*mys*_*.pdf >> f:\news\main\stamp\%2toimys

m:
cd\olivetoi\hbl
dir \\PUB-OPI\PUBS\TOI\HUBLI\OUT\%2*toibg*_h_*.ps > f:\news\main\stamp\%2toihbl
dir \\PUB-OPI\PUBS\TOI\COLOUR\OUT\%2*toibg*_h_*.ps >> f:\news\main\stamp\%2toihbl
echo --------------------------------- >> f:\news\main\stamp\%2toihbl
dir k:\pageout\hbl\out\%2*toibg*_h_*.pdf >> f:\news\main\stamp\%2toihbl

m:
cd\olivetoi\mgl
dir \\PUB-OPI\PUBS\TOI\MANIPAL\OUT\%2*mang*_*.ps > f:\news\main\stamp\%2toimgl
dir \\PUB-OPI\PUBS\TOI\COLOUR\OUT\%2*mang*.ps >> f:\news\main\stamp\%2toimgl
echo -------------- ---------------- >> f:\news\main\stamp\%2toimgl
dir k:\pageout\mgl\out\%2*mang*_*.pdf >> f:\news\main\stamp\%2toimgl

m:
cd\olivetoi\nie
dir \\PUB-OPI\PUBS\TOI\BW\OUT\%2*nie*_*.ps > f:\news\main\stamp\%2toinie
dir \\PUB-OPI\PUBS\TOI\COLOUR\OUT\%2*nie*.ps >> f:\news\main\stamp\%2toinie
echo ------------------------------ >> f:\news\main\stamp\%2toinie
dir k:\pageout\nie\out\%2*nie*_*.pdf >> f:\news\main\stamp\%2toinie

m:
cd\oliveet\ban
dir \\PUB-ETPDF\PUBS\ET\COLOUR\OUT\%2*etbg*_*.ps > f:\news\main\stamp\%2etban
dir \\PUB-ETPDF\PUBS\ET\BW\OUT\%2*etbg*_*.ps >> f:\news\main\stamp\%2etban
echo ------------------------------ >> f:\news\main\stamp\%2etban
dir j:\et\blr\pageout\%2*etbg*_*.pdf >> f:\news\main\stamp\%2etban

m:
cd\oliveet\che
dir \\PUB-ETPDF\PUBS\ET\CHENNAI\OUT\%2*etch*_*.ps > f:\news\main\stamp\%2etche
echo ------------------------------ >> f:\news\main\stamp\%2etche
dir j:\et\che\pageout\%2*etch*_*.pdf >> f:\news\main\stamp\%2etche

m:
cd\oliveet\hyd
dir \\PUB-ETPDF\PUBS\ET\HYDERABAD\OUT\%2*eth*_*.ps > f:\news\main\stamp\%2ethyd
echo ------------------------------ >> f:\news\main\stamp\%2ethyd
dir j:\et\hyd\pageout\%2*eth*_*.pdf >> f:\news\main\stamp\%2ethyd


m:
cd\oliveet\koc
dir \\PUB-ETPDF\PUBS\ET\COCHIN\OUT\%2*etc*_*.ps > f:\news\main\stamp\%2etkoc
echo ------------------------------ >> f:\news\main\stamp\%2etkoc
dir j:\et\koc\pageout\%2*etc*_*.pdf >> f:\news\main\stamp\%2etkoc
C:
CD\
MD MAIN
CD MAIN
MD prakash
f:
CD\news\main\stamp
move F:\NEWS\MAIN\STAMP\%2*.* C:\MAIN\PRAKASH
copy c:\main\PRAKASH\%2*.* f:\news\main\stamp

:end
@echo today date and issue date

-------------------------------------------------

This is single programme ...Sample programme for understanding syntax concept:

Deleting, Copy files to different directory, backup 
Understand the concept of programme.


@echo on
@echo ** pl chk f: g: m: directory *** 
f:
g:
m:
sleep 10

if "%1"== goto tmn

rem ********************************** tomorrow story backup raghu
echo y|copy g:\et\%1\snd\*.* d:\main\raghu
echo y|copy g:\et\%1\snd\*.* e:\enews\eco
echo y|copy g:\et\%1\snd\*.* d:\main\raghu
echo y|copy g:\et\%1\snd\*.* g:\eco\eco
rem ********************************** tomorrow story backup raghu

rem copy all ig pages to thanthi directory *****************
xcopy g:\et\%1\etpdf\*_etm_bb*.* g:\et\%1\thanthi


rem ********** copy all chennai pdf file to thanthi directory ********
xcopy32 j:\pdfview\*_etch*.* g:\et\%1\thanthi
rem *****************************end

echo y|move g:\eco\eto\*.* d:\main\eto
echo y|move g:\eco\eta\*.* d:\main\eta


echo y|del k:\pageout\mgl\view\%1*.*
echo y|del k:\pageout\mys\out\%1*.*
echo y|del k:\pageout\mys\view\%1*.*


echo y|del k:\pageout\view\*.pdf
echo y|del k:\graphic\*.*


rem one set ************************
rem below line will delete onecagain if you run this bat file onceagain
echo y|del f:\news\main\reg\back\*.*
echo y|del f:\times\btimes\btcity\backup\*.*


echo y|move f:\news\main\reg\pict\*.* f:\news\main\reg\back
echo y|del f:\news\main\reg\cbe\*.* 
echo y|del f:\news\main\reg\goa\*.* 


echo y|del f:\news\main\reg\vizag\*.* 
rem one sent end *******************
echo y|del f:\news\main\rpt\system\*.*
echo y|del f:\news\main\rpt\prepress\*.*


echo y|del f:\news\zipin\*.*
echo y|del f:\news\zipout\*.*

echo y|del f:\news\zipout\*.*
echo y|del f:\news\pun\*.*


echo y|del f:\times\btimes\chandi\*.*
echo y|del q:\tc\cache\*.*

echo y|move f:\times\btimes\btcity\??bt1*.* f:\times\btimes\btcity\backup
echo y|move f:\times\btimes\btcity\??bt2*.* f:\times\btimes\btcity\backup


echo y|del f:\times\btimes\btcity\??bt1*.*
echo y|del f:\times\btimes\btcity\??bt2*.*


echo y|del d:\main\rpt\*.*
echo y|del d:\main\net\*.*
echo y|del c:\main\input\pen\*.*


echo y|del d:\main\input\mpl\*.*
echo y|del d:\main\inbox\*.*
echo y|del d:\main\input\data1\*.*


echo y|del g:\eco\all\*.*
echo y|del g:\eco\eco\*.*
echo y|del g:\eco\allg\*.*


echo y|del g:\eco\toiedit\*.*
echo y|del g:\eco\etedit\*.*
echo y|del g:\eco\daily\*.*


echo y|del j:\et\hyd\out\*.*
echo y|del j:\et\che\out\*.*
echo y|del j:\et\blr\*.ps


echo y|del j:\et\che\view\*.*
echo y|del j:\et\koc\view\*.*

echo y|del j:\et\ham\sou\*.*
echo y|del j:\et\sou\*.*


echo y|del j:\et\graphic\lores\*.*
echo y|del j:\et\link\*.*


move d:\main\toionlin\*.zip f:\news\main\toionlin /m
echo y|move d:\main\etonline\*.zip g:\eco\main\etonline
echo y|del d:\main\toionlin\*.zip
echo y|del d:\main\etonline\*.zip


rem ************* olive toi-nie *************
rem move m:\olivetoi\nie\*.* n:\amssbak\olivetoi\ban /m
echo y|del m:\olivetoi\nie\%1*.* 
echo y|del m:\olivetoi\nie\ps\%1*.* 
echo y|del m:\olivetoi\nie\zip\%1*.*


rem ************* olive toi-ban page *************
rem move m:\olivetoi\ban\*.* n:\amssbak\olivetoi\ban /m
e
echo y|del m:\olivetoi\ban\zip\%1*.*
rem ************* olive toi-ban page end
sleep 10

echo y|del m:\olivetoi\mgl\ps\%1*.*
rem move m:\olivetoi\mgl\zip\*.* n:\amssbak\olivetoi\mgl
echo y|del m:\olivetoi\mgl\zip\%1*.*
rem ************* olive toi-mgl page end

echo y|del m:\olivetoi\mys\ps\%1*.*
rem move m:\olivetoi\mys\zip\*.* n:\amssbak\olivetoi\mys
echo y|del m:\olivetoi\mys\zip\%1*.*

rem ************* olive toi-mys page end


rem ************* olive page - et - ban, che, koc, hyd *************
rem move m:\oliveet\ban\*.* n:\amssbak\oliveet\ban
echo y|del m:\oliveet\ban\%1*.*
echo y|del m:\oliveet\ban\ps\%1*.*
echo y|del m:\oliveet\ban\zip\%1*.*


rem move m:\oliveet\che\*.* n:\amssbak\oliveet\che
echo y|del m:\oliveet\che\%1*.*
echo y|del m:\oliveet\che\ps\%1*.*
echo y|del m:\oliveet\che\zip\%1*.*


rem move m:\oliveet\koc\*.* n:\amssbak\oliveet\koc
echo y|del m:\oliveet\koc\%1*.*
echo y|del m:\oliveet\koc\ps\%1*.*
echo y|del m:\oliveet\koc\zip\%1*.*
rem move m:\oliveet\hyd\*.* n:\amssbak\oliveet\hyd
echo y|del m:\oliveet\hyd\%1*.*
echo y|del m:\oliveet\hyd\ps\%1*.*
echo y|del m:\oliveet\hyd\zip\%1*.*
rem ************* olive page - et - all - end ******

pkzipn g:\eco\main\etonline\%1ethpgs g:\eco\daily\*etbh*.*
pkzipn g:\eco\main\etonline\%1etkpgs g:\eco\daily\*etbk*.*


echo y|del f:\news\main\toionlin\*.qxd
echo y|del f:\news\daily\*.*
echo y|del g:\eco\daily\*.*
rem *************** toi and et online zip end


echo y|del k:\temp\toisch\*.*
echo y|del k:\pageout\blr\out\*toisch*.*


xcopy32 j:\pics\graphic\temp\*.* g:\et\%1\thanthi /m


echo y|del f:\users\times\wire\business\*.*
echo y|del f:\users\times\wire\sports\*.*

echo y|del f:\users\times\wire\ap\*.*


echo y|del g:\et\wire\business\*.*
echo y|del g:\et\wire\sports\*.*


echo y|del g:\et\wire\reu\*.*
echo y|del g:\et\wire\ap\*.*

echo y|xcopy k:\pageout\vpl\out\*.* n:\lib\toipdf\%1 /m
echo y|xcopy k:\pageout\vpl\view\*.* n:\lib\toipdf\%1 /m


goto tmn
:end
@echo ** please type yesterday date, today date**
@echo 1 = yesterday date 2 = today date
@echo cleaning was done upto stopn1.bat %1 >> p:\bat\stopn2.txt


:tmn

@echo please type today date only
@echo stopn.bat %date%

Sample programme - Understanding syntax concept used in many places.


rem @echo off
rem CAUTION : - DO NOT MAKE LOWER CASE OR UPPER CASE


rem change toi metro change t to tm, _c_ to _m_, toic24(schedule),
rem change toi metro k-toilas.cty to *.met


rem to chk missing files, f:\news\main\toi\pen, hbl, mpl, hyd
rem %1 tomorrow date
rem %2 and %3 
rem page 2 delete was included at the end.
rem change year and month every month.

f:
cd\news
md main
cd main
md toi
md et


if "%1"=="" goto end
if "%2"=="" goto end 

echo y|del f:\news\main\toi\*.*
echo y|del f:\news\main\toi\et\*.*
echo y|del f:\news\main\toi\temp\*.*
echo y|del f:\news\main\toi\misc\*.*

:start


rem sleep 600

@echo ********* toi pages checking *********
@echo ********************


@echo . > f:\news\main\toi\k-toipgs.snt
echo ************************************** >> f:\news\main\toi\k-toipgs.snt
echo * TOI PAGES SENT TO :- >> f:\news\main\toi\k-toipgs.snt
echo * PEENYA - HUBLI >> f:\news\main\toi\k-toipgs.snt
echo ************************ >> f:\news\main\toi\k-toipgs.snt
if exist k:\pageout\blr\out\%1*_toibg_mpr_01_b_c_*_r*.* goto page001
if not exist k:\pageout\blr\out\%1*_toibg_mpr_01_b_c_*_r*.* goto page01
:page01
echo test > f:\news\main\toi\%1t01.pdf
goto next2
:page001
del f:\news\main\toi\%1t01.pdf 
echo %1t01.pdf >> f:\news\main\toi\k-toipgs.snt
rem new > sign above here *****
:next2


if exist k:\pageout\blr\out\%1*_toibg_mpr_02_b_c_*_r*.* goto page002
if not exist k:\pageout\blr\out\%1*_toibg_mpr_02_b_c_*_r*.* goto page02
:page02
echo test > f:\news\main\toi\%1t02.pdf
goto next3
:page002
del f:\news\main\toi\%1t02.pdf
echo %1t02.pdf >> f:\news\main\toi\k-toipgs.snt
:next3


if exist k:\pageout\blr\out\%1*_toibg_mpr_03_b_c_*_r*.* goto page003
if not exist k:\pageout\blr\out\%1*_toibg_mpr_03_b_c_*_r*.* goto page03
:page03
echo test > f:\news\main\toi\%1t03.pdf
goto next4
:page003
del f:\news\main\toi\%1t03.pdf
echo %1t03.pdf >> f:\news\main\toi\k-toipgs.snt
:next4


if exist k:\pageout\blr\out\%1*_toibg_mpr_04_b_c_*_r*.* goto page004
if not exist k:\pageout\blr\out\%1*_toibg_mpr_04_b_c_*_r*.* goto page04
:page04
echo test > f:\news\main\toi\%1t04.pdf
goto next5
:page004
del f:\news\main\toi\%1t04.pdf
echo %1t04.pdf >> f:\news\main\toi\k-toipgs.snt
:next5


if exist k:\pageout\blr\out\%1*_toibg_mpr_05_b_c_*_r*.* goto page005
if not exist k:\pageout\blr\out\%1*_toibg_mpr_05_b_c_*_r*.* goto page05
:page05
echo test > f:\news\main\toi\%1t05.pdf
goto next6
:page005
del f:\news\main\toi\%1t05.pdf
echo %1t05.pdf >> f:\news\main\toi\k-toipgs.snt
:next6


if exist k:\pageout\blr\out\%1*_toibg_mpr_06_b_c_*_r*.* goto page006
if not exist k:\pageout\blr\out\%1*_toibg_mpr_06_b_c_*_r*.* goto page06
:page06
echo test > f:\news\main\toi\%1t06.pdf
goto next7
:page006
del f:\news\main\toi\%1t06.pdf
echo %1t06.pdf >> f:\news\main\toi\k-toipgs.snt
:next7


if exist k:\pageout\blr\out\%1*_toibg_mpr_07_b_c_*_r*.* goto page007
if not exist k:\pageout\blr\out\%1*_toibg_mpr_07_b_c_*_r*.* goto page07
:page07
echo test > f:\news\main\toi\%1t07.pdf
goto next8
:page007
del f:\news\main\toi\%1t07.pdf
echo %1t07.pdf >> f:\news\main\toi\k-toipgs.snt
:next8

if exist k:\pageout\blr\out\%1*_toibg_mpr_08_b_c_*_r*.* goto page008
if not exist k:\pageout\blr\out\%1*_toibg_mpr_08_b_c_*_r*.* goto page08
:page08
echo test > f:\news\main\toi\%1t08.pdf
goto next9
:page008
del f:\news\main\toi\%1t08.pdf
echo %1t08.pdf >> f:\news\main\toi\k-toipgs.snt
:next9


if exist k:\pageout\blr\out\%1*_toibg_mpr_09_b_c_*_r*.* goto page009
if not exist k:\pageout\blr\out\%1*_toibg_mpr_09_b_c_*_r*.* goto page09
:page09
echo test > f:\news\main\toi\%1t09.pdf
goto next10
:page009
del f:\news\main\toi\%1t09.pdf
echo %1t09.pdf >> f:\news\main\toi\k-toipgs.snt
:next10

if exist k:\pageout\blr\out\%1*_toibg_mpr_10_b_c_*_r*.* goto page010
if not exist k:\pageout\blr\out\%1*_toibg_mpr_10_b_c_*_r*.* goto page10
:page10
echo test > f:\news\main\toi\%1t10.pdf
goto next11
:page010
del f:\news\main\toi\%1t10.pdf
echo %1t10.pdf >> f:\news\main\toi\k-toipgs.snt
:next11


if exist k:\pageout\blr\out\%1*_toibg_mpr_11_b_c_*_r*.* goto page011
if not exist k:\pageout\blr\out\%1*_toibg_mpr_11_b_c_*_r*.* goto page11
:page11
echo test > f:\news\main\toi\%1t11.pdf
goto next12
:page011
del f:\news\main\toi\%1t11.pdf
echo %1t11.pdf >> f:\news\main\toi\k-toipgs.snt
:next12

if exist k:\pageout\blr\out\%1*_toibg_mpr_12_b_c_*_r*.* goto page012
if not exist k:\pageout\blr\out\%1*_toibg_mpr_12_b_c_*_r*.* goto page12
:page12
echo test > f:\news\main\toi\%1t12.pdf
goto next13
:page012
del f:\news\main\toi\%1t12.pdf
echo %1t12.pdf >> f:\news\main\toi\k-toipgs.snt
:next13


if exist k:\pageout\blr\out\%1*_toibg_mpr_13_b_c_*_r*.* goto page013
if not exist k:\pageout\blr\out\%1*_toibg_mpr_13_b_c_*_r*.* goto page13
:page13
echo test > f:\news\main\toi\%1t13.pdf
goto next14
:page013
del f:\news\main\toi\%1t13.pdf
echo %1t13.pdf >> f:\news\main\toi\k-toipgs.snt
:next14


if exist k:\pageout\blr\out\%1*_toibg_mpr_14_b_c_*_r*.* goto page014
if not exist k:\pageout\blr\out\%1*_toibg_mpr_14_b_c_*_r*.* goto page14
:page14
echo test > f:\news\main\toi\%1t14.pdf
goto next15
:page014
del f:\news\main\toi\%1t14.pdf
echo %1t14.pdf >> f:\news\main\toi\k-toipgs.snt
:next15

if exist k:\pageout\blr\out\%1*_toibg_mpr_15_b_c_*_r*.* goto page015
if not exist k:\pageout\blr\out\%1*_toibg_mpr_15_b_c_*_r*.* goto page15
:page15
echo test > f:\news\main\toi\%1t15.pdf
goto next16
:page015
del f:\news\main\toi\%1t15.pdf
echo %1t15.pdf >> f:\news\main\toi\k-toipgs.snt
:next16


if exist k:\pageout\blr\out\%1*_toibg_mpr_16_b_c_*_r*.* goto page016
if not exist k:\pageout\blr\out\%1*_toibg_mpr_16_b_c_*_r*.* goto page16
:page16
echo test > f:\news\main\toi\%1t16.pdf
goto next17
:page016
del f:\news\main\toi\%1t16.pdf
echo %1t16.pdf >> f:\news\main\toi\k-toipgs.snt
:next17


if exist k:\pageout\blr\out\%1*_toibg_mpr_17_b_c_*_r*.* goto page017
if not exist k:\pageout\blr\out\%1*_toibg_mpr_17_b_c_*_r*.* goto page17
:page17
echo test > f:\news\main\toi\%1t17.pdf
goto next18
:page017
del f:\news\main\toi\%1t17.pdf
echo %1t17.pdf >> f:\news\main\toi\k-toipgs.snt
:next18

if exist k:\pageout\blr\out\%1*_toibg_mpr_18_b_c_*_r*.* goto page018
if not exist k:\pageout\blr\out\%1*_toibg_mpr_18_b_c_*_r*.* goto page18
:page18
echo test > f:\news\main\toi\%1t18.pdf
goto next19
:page018
del f:\news\main\toi\%1t18.pdf
echo %1t18.pdf >> f:\news\main\toi\k-toipgs.snt
:next19


if exist k:\pageout\blr\out\%1*_toibg_mpr_19_b_c_*_r*.* goto page019
if not exist k:\pageout\blr\out\%1*_toibg_mpr_19_b_c_*_r*.* goto page19
:page19
echo test > f:\news\main\toi\%1t19.pdf
goto next20
:page019
del f:\news\main\toi\%1t19.pdf
echo %1t19.pdf >> f:\news\main\toi\k-toipgs.snt
:next20

if exist k:\pageout\blr\out\%1*_toibg_mpr_20_b_c_*_r*.* goto page020
if not exist k:\pageout\blr\out\%1*_toibg_mpr_20_b_c_*_r*.* goto page20
:page20
echo test > f:\news\main\toi\%1t20.pdf
goto next21
:page020
del f:\news\main\toi\%1t20.pdf
echo %1t20.pdf >> f:\news\main\toi\k-toipgs.snt
:next21


if exist k:\pageout\blr\out\%1*_toibg_mpr_21_b_c_*_r*.* goto page021
if not exist k:\pageout\blr\out\%1*_toibg_mpr_21_b_c_*_r*.* goto page21
:page21
echo test > f:\news\main\toi\%1t21.pdf
goto next22
:page021
del f:\news\main\toi\%1t21.pdf
echo %1t21.pdf >> f:\news\main\toi\k-toipgs.snt
:next22


if exist k:\pageout\blr\out\%1*_toibg_mpr_22_b_c_*_r*.* goto page022
if not exist k:\pageout\blr\out\%1*_toibg_mpr_22_b_c_*_r*.* goto page22
:page22
echo test > f:\news\main\toi\%1t22.pdf
goto next23
:page022
del f:\news\main\toi\%1t22.pdf
echo %1t22.pdf >> f:\news\main\toi\k-toipgs.snt
:next23


if exist k:\pageout\blr\out\%1*_toibg_mpr_23_b_c_*_r*.* goto page023
if not exist k:\pageout\blr\out\%1*_toibg_mpr_23_b_c_*_r*.* goto page23
:page23
echo test > f:\news\main\toi\%1t23.pdf
goto next24
:page023
del f:\news\main\toi\%1t23.pdf
echo %1t23.pdf >> f:\news\main\toi\k-toipgs.snt
:next24


if exist k:\pageout\blr\out\%1*_toibg_mpr_24_b_c_*_r*.* goto page024
if not exist k:\pageout\blr\out\%1*_toibg_mpr_24_b_c_*_r*.* goto page24
:page24
echo test > f:\news\main\toi\%1t24.pdf
goto next25
:page024
del f:\news\main\toi\%1t24.pdf
echo %1t24.pdf >> f:\news\main\toi\k-toipgs.snt
:next25




rem ************ hubli pages checking start
if exist k:\pageout\hbl\out\%1*_toibg_mpr_01_b_h_*_r*.* goto hbl1
if not exist k:\pageout\hbl\out\%1*_toibg_mpr_01_b_h_*_r*.* goto hbl1a
:hbl1a
echo test > f:\news\main\toi\%1th01.pdf
goto next-h1
:hbl1
del f:\news\main\toi\%1th01.pdf
echo %1th01.pdf >> f:\news\main\toi\k-toipgs.snt
:next-h1


if exist k:\pageout\hbl\out\%1*_toibg_mpr_03_b_h_*_r*.* goto hbl2
if not exist k:\pageout\hbl\out\%1*_toibg_mpr_03_b_h_*_r*.* goto hbl2a
:hbl2a
echo test > f:\news\main\toi\%1th03.pdf
goto next-h2
:hbl2
del f:\news\main\toi\%1th03.pdf
echo %1th03.pdf >> f:\news\main\toi\k-toipgs.snt
:next-h2


if exist k:\pageout\hbl\out\%1*_toibg_mpr_04_b_h_*_r*.* goto hbl4
if not exist k:\pageout\hbl\out\%1*_toibg_mpr_04_b_h_*_r*.* goto hbl4a
:hbl4a
echo test > f:\news\main\toi\%1th04.pdf
goto next-h3
:hbl4
del f:\news\main\toi\%1th04.pdf
echo %1th04.pdf >> f:\news\main\toi\k-toipgs.snt
:next-h3


del f:\news\main\toi\temp\%1toic*.%1
echo dated - %1 = total toi pages=%2 > f:\news\main\toi\temp\%1toic%2.%1


if exist f:\news\main\toi\temp\%1toic16.%1 goto toipg1
if not exist f:\news\main\toi\temp\%1toic16.%1 goto toipg2
:toipg1
del f:\news\main\toi\%1t17*.*
del f:\news\main\toi\%1t18*.*
del f:\news\main\toi\%1t19*.*
del f:\news\main\toi\%1t20*.*
del f:\news\main\toi\%1t21*.*
del f:\news\main\toi\%1t22*.*
del f:\news\main\toi\%1t23*.*
del f:\news\main\toi\%1t24*.*
:toipg2
if exist f:\news\main\toi\temp\%1toic18.%1 goto toipg3
if not exist f:\news\main\toi\temp\%1toic18.%1 goto toipg4
:toipg3
del f:\news\main\toi\%1t19*.*
del f:\news\main\toi\%1t20*.*
del f:\news\main\toi\%1t21*.*
del f:\news\main\toi\%1t22*.*
del f:\news\main\toi\%1t23*.*
del f:\news\main\toi\%1t24*.*
:toipg4


if exist f:\news\main\toi\temp\%1toic20.%1 goto toipg5
if not exist f:\news\main\toi\temp\%1toic20.%1 goto toipg6
:toipg5
del f:\news\main\toi\%1t21*.*
del f:\news\main\toi\%1t22*.*
del f:\news\main\toi\%1t23*.*
del f:\news\main\toi\%1t24*.*
:toipg6


if exist f:\news\main\toi\temp\%1toic22.%1 goto toipg7
if not exist f:\news\main\toi\temp\%1toic22.%1 goto toipg8
:toipg7
del f:\news\main\toi\%1t23*.*
del f:\news\main\toi\%1t24*.*

:toipg8

if exist f:\news\main\toi\temp\%1toic16.%1 goto toipg9
if not exist f:\news\main\toi\temp\%1toic16.%1 goto toipg10
:toipg9
del f:\news\main\toi\%1t17*.*
del f:\news\main\toi\%1t18*.*
del f:\news\main\toi\%1t19*.*
del f:\news\main\toi\%1t20*.*
del f:\news\main\toi\%1t21*.*
del f:\news\main\toi\%1t22*.*
del f:\news\main\toi\%1t23*.*
del f:\news\main\toi\%1t24*.*
:toipg10


del c:\main\input\??th02*.*
del c:\main\input\?th02*.*
rem ******* *************************** times pages over


@echo. > f:\news\main\toi\k-toipgs.dir
@echo ******************************************** >> f:\news\main\toi\k-toipgs.dir
@echo * BANGALORE - TOI PAGES - DIR >> f:\news\main\toi\k-toipgs.dir
@echo ***************************************** >> f:\news\main\toi\k-toipgs.dir
dir k:\pageout\blr\out\*.* >> f:\news\main\toi\k-toipgs.dir


@echo *************** >> f:\news\main\toi\k-toipgs.dir
@echo * HUBLI - TOI PAGES - DIR >> f:\news\main\toi\k-toipgs.dir
@echo ******************************************** >> f:\news\main\toi\k-toipgs.dir
dir k:\pageout\hbl\out\*.* >> f:\news\main\toi\k-toipgs.dir


rem ************** times of india pending pages ***************
@echo. > f:\news\main\toi\k-toipgs.pen
@echo ********************** >> f:\news\main\toi\k-toipgs.pen
@echo * P E N D I N G - TOI PAGES >> f:\news\main\toi\k-toipgs.pen
@echo * Peenya Hubli >> f:\news\main\toi\k-toipgs.pen
@echo ***************************************** >> f:\news\main\toi\k-toipgs.pen
dir f:\news\main\toi\%1t*.* >> f:\news\main\toi\k-toipgs.pen


@echo. > f:\news\main\toi\k-hblpgs.pen
@echo *********************** >> f:\news\main\toi\k-hblpgs.pen
@echo * PENDING - TOI PAGES >> f:\news\main\toi\k-hblpgs.pen
@echo * H U B L I >> f:\news\main\toi\k-hblpgs.pen
@echo ********************* >> f:\news\main\toi\k-hblpgs.pen
dir f:\news\main\toi\%1th*.* >> f:\news\main\toi\k-hblpgs.pen

rem **** times of india city and metro dir ********
@echo. > f:\news\main\toi\misc\k-toicty.dir
@echo ********************* >> f:\news\main\toi\misc\k-toicty.dir
@echo * CITY - TOI PAGES - DIR >> f:\news\main\toi\misc\k-toicty.dir
@echo * PEENYA >> f:\news\main\toi\misc\k-toicty.dir
@echo ***************************************** >> f:\news\main\toi\misc\k-toicty.dir
dir k:\pageout\blr\out\%1*_toibg_mpr_*_b_c_*_r*.* >> f:\news\main\toi\misc\k-toicty.dir


rem ************** times of india last page dir ***************
@echo. > f:\news\main\toi\misc\k-toilas.cty
@echo ******************* >> f:\news\main\toi\misc\k-toilas.cty
@echo * CITY - TOI - LAST PAGE >> f:\news\main\toi\misc\k-toilas.cty
@echo * PEENYA >> f:\news\main\toi\misc\k-toilas.cty
@echo ******************** >> f:\news\main\toi\misc\k-toilas.cty
dir k:\pageout\blr\out\%1*_toibg_mpr_*_b_c_*_r*.* /od >> f:\news\main\toi\misc\k-toilas.cty


@echo ********************** toi pages sent ******** >> f:\news\main\toi\all-menu
copy f:\news\main\toi\all-menu+ = f:\news\main\toi\k-toipgs.snt /y
@echo . >> f:\news\main\toi\all-menu
@echo ****************toi end********* >> f:\news\main\toi\all-menu
@echo *************toi end************** >> f:\news\main\toi\all-menu


rem * toi pages
call p:\bat\rev.bat %1
notepad.exe f:\news\main\toi\k-toipgs.pen
notepad.exe f:\news\main\toi\k-toipgs.snt
notepad.exe f:\news\main\toi\misc\k-toilas.cty
notepad.exe f:\news\main\toi\k-toipgs.dir

f:
cd\news\main\toi
rem close "k-toipgs.pen - Notepad"
rem close "k-toipgs.snt - Notepad"
f:
cd\news\main\toi\misc
rem close.exe "k-toilas.cty - Notepad"
rem close.exe "k-toipgs - Notepad"
rem call p:\bat\rev.bat %1

rem ncftpput -u opi@10.130.7.37 -p opi 10.130.2.92 \wwwroot\toiet-chk f:\news\main\toi\all-menu*.*

REM goto start

goto tmn
:end
cls
rem follow this order ** t/m date, toi , bgl , che, hyd, koc
@echo. 1= tomorrow date 2= toi city edition total page number 
:tmn

----------------------------------------------------


END

START WITH 

SIMPLE BAT FILE  ONE LINE COMMAND LIKE

COPY,  CHANGING DIRECTORY, CREATING DIRECTORY.
TAKE EXTRA CARE WHEN YOU ARE 
DELETING FILES - .
THANK YOU, GOOD LUCK.

My email address atmeganathan@gmail.com

2 - Batch script programming 2020 July

Page 02 

------------------

How to open Multiple Application:-

 Syntax  
 
 start

Description:-

To run specified Programme inside the batch file 
eg. Notepad.exe or word.exe or photoshop.exe 
or all executable files.

Examples:-

notepad.exe
google.com
gmail.com
chrome.exe open all windows in one shot

Sample programme 1:-

@echo off

start c:\main\notepad.exe
start c:\main\google.com
start c:\main\gmail.com
start c:\main\chrome.exe
start c:\main\ieexplore.exe

:: Opening all programmes in one shot

exit
------------------------------
How to open Multiple APP by typing first letter of APP:-


 Syntax
 
  %1  to  %9   
 
Description:-

How to display variables

Example 1:-

input number between 1 to 9 and display same numbers

Sample programme 1:-

@echo off

::UPTO 9 COMMAND LINE ARGUMENT CAN BE GIVEN

if "%1"=="" goto end1
if "%2"=="" goto end1
if "%3"=="" goto end1
if "%4"=="" goto end1
if "%5"=="" goto end1
if "%6"=="" goto end1
if "%7"=="" goto end1
if "%8"=="" goto end1
if "%9"=="" goto end1
echo %1
echo  %2
echo  %3
echo  %4
echo  %5
echo  %6
echo  %7
echo  %8
echo  %9
:END1


How to run the programme: c:\bat\test2.bat 1 2 3 4 5 6 7 8 9 
programme will display 1 2 3 4 5 6 7 8 9 


Example 2:-

How to open Multiple APP by typing first letter of APP:-

To run specified Programme inside the batch file 
eg. Notepad.exe or word.exe or photoshop.exe 
or all executable files.

Open following in batch file

::@echo off
:: file name test3.bat 

if  "%1"=="n" goto prg1
if  "%1"=="w" goto prg2
if  "%1"=="ca" goto prg3
if  "%1"=="p" goto prg4

:prg1
 start c:\windows\system32\Notepad.exe
goto end10

:prg2
 start C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\wordpad.exe
goto end10

:prg3
 start C:\ProgramData\Microsoft\Windows\"Start Menu"\Programs\Accessories\calc.exe
goto end10

:prg4
 start C:\ProgramData\Microsoft\Windows\"Start Menu"\Programs\Accessories\paint.exe
goto end10

:end10
@echo Please type    n   or    w    or    ca    or    p


NOTE;- Keep correct path of programme file.

To open notepad type n

eg. c:\windows\system32\test3.bat n

To open wordpad type w

eg. c:\windows\system32\test3.bat w

------------------------------

How to add New Path to Existing windows Path:-

 Syntax   
 
 set  

Description:-

set patth=%path%;c:\bat;

Add    C:\bat    directory to existing path, so that, exe file, or com file, or  bat file can run anywhere.
Type this command in dos prompt.

Set command used to assigned variables.

---------------------------

How to Hide files using attrib:-


 Syntax   
 
 attrib

Description:-

Displays, sets, or removes attributes assigned to files or directory

eg. hiden files, protected file, read only files

Examples:-

-r    removes read only files    +r   Put file read only

-h    removed hide  only files    +h  Hide the files

Sample syntax:-

Fore more parameters type    attrib/?

attrib  *.*     -r

attrib    *.*  +r  

 Syntax 
  
     for %%f

Description:-

By using this Syntax we can Open all text files automaticaly one by one
 through notepad.exe

Examples 1:-

for  %%f in (*.txt) do notepad.exe %%f

Sample programme:-

@echo off

for  %%f in (*.txt) do notepad.exe %%f

:end

Example 2

:: how to copy 10 or more directory files to another directory:

copy six different directory 

c:\main\pti , c:\main\wld, c:\main\gen, c:\main\bus, c:\main\spt,  c:\main\uni, 

files to  c:\allfiles\pti, c:\allfiles\wld   etc etc 
 
Here %%K variable to directory pti wld gen bus spt uni

Sample Programme:- 

@echo off

::goto six different directory copy all file to c:\main\six different directory
for %%K in (PTI WLD GEN BUS SPT UNI ) do    copy     C:\main\%%K\*.*   to     c:\allfiles\%%k

::goto six different directory xcopy all file to c:\main\six different directory
for %%k in (PTI WLD GEN BUS SPT UNI ) do    y|xcopy    C:\main\%%k\*.*    to      c:\allfiles\%%k
:: y|xcopy   here pipe sign given for do not prompt if file overwrite.

::goto six different directory  move all file to c:\main\six different directory
for %%k in (PTI WLD GEN BUS SPT UNI ) do    move     C:\main\%%k\*.*   to      c:\allfiles\%%k

::goto all six different directoy delete List*.* file
for %%K in (PTI WLD GEN BUS SPT UNI ) do    del        C:\main \%%K\list.* 

:: copy  or move or xcopy from directory c:\day  to  f:\  
:: total 7 directory are there in c:\day directory, one by one go to that directory, and copy all files
to f: drive.
:end

Example:- 

 The above batch file is equal to below batch file. Manualy copying 
one directory to another directory.
copy  c:\main\pti\*.*  to   f:\main\pti   

---------------------------

How to know your system information:-

 Syntax 
  
  systeminfo    

Description:-

Displays detailed configuration information about a your computer and
 its working operating system , including os-configuration,
 security information, product ID, and hardware properties
 (such as RAM, disk space, and network cards).

Examples 1:-

To view configuration information for a computer named Srvmain, type: systeminfo /s srvmain To remotely view configuration information for a computer named Srvmain2 that is located on the Maindom domain, type

 systeminfo /s    this will give information about computer

 systeminfo /s typecomputername /u domainname-with path use \ slash

To remotely view configuration information (in list format) for a computer named Srvmain2 that is located on the Maindom domain, type:

Sample programme:-

@echo off
:: store system information fo test.txt

systeminfo   >>    c:\main\test.txt

notepad.exe c:\main\test.txt

:: put the output display to test.txt and open  notepad automaticaly.

:end
More Parameters and detail description goto c:\windows\system32\systeminfo/?
---------------------------

How to scan system files and replace correct one:-

 Syntax 
  
  sfc   

Description:-
 
Importent dos commands -- System File checker.......
Scans and verifies the integrity of all protected system files and replaces incorrect versions files with correct versions files.

Examples 1:-

System File checker.......
sfc [/scannow] [/verifyonly] [/scanfile=<file>] [/verifyfile=<file>] 
[/offwindir=<offline windows directory> /offbootdir=<offline boot directory>]

Specified full path and filename before typing command:-
sfc /scannow ( Scans the integrity of all protected system files and repairs files with problems when possible.)
sfc /verifyonly Scans integrity of all protected system files. No repair operation is performed.
sfc /scanfile Scans integrity of the specified file and repairs the file if problems are detected, when possible.
sfc /verifyfile verifies the integrity of the specified file. No repair operation is performed.
sfc /offwindir Specifies the location of the offline windows directory, for offline repair.
sfc /offbootdir Specifies the location of the offline boot directory for offline

Sample programme for System File checker.......:-

type the individual command in dos prompt
---------------------------

How to run programmes at specific time and close programmes at specific time:-

 Syntax 
  
  schtasks    

Description:-

Schedules commands and programs to run periodically or  at a specific time. 
Adds and removes tasks from the schedule.

Schedule Task used to RUN  a programme at perticular given time  time.
or
Schedule task can be used for remainder by creating message box 

I used schedule task for remainder more than 20 programmes to run automaticaly and close programmes automaticaly and 20 remainder alert messages .

Examples 1:-

Schedules commands and programs to run periodically at a specific time. 

 How to make schedule task, external Link given below:-



Task Scheduler
https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-task-scheduler


Task Scheduler for developers
https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page

You can use the Task Scheduler to execute tasks such as starting an application, sending an email message, or showing a message box. Tasks can be scheduled to execute in response to these events, or triggers.
  • When a specific system event occurs.
  • At a specific time.
  • At a specific time on a daily schedule.
  • At a specific time on a weekly schedule.
  • At a specific time on a monthly schedule.
  • At a specific time on a monthly day-of-week schedule.
  • When the computer enters an idle state.
  • When the task is registered.
  • When the system is booted.
  • When a user logs on.
  • When a Terminal Server session changes state.

------------------
How to check performance of monitor:-

Sample Programme:-

@echo off
:: Run the bat file

C:\Windows\System32\Eventvwr.exe

 C:\Windows\System32\Perfmon.exe

:end

---------

How to run Menu to choose programme

 Syntax 
  
  choice,exe   

NOTE : Menu batch script example programme created by me. 

Description:-

@echo off
:: Give file name menu1.bat
:: Menu drive batch file we have to select number 1 to 9 to run the programme.
echo 1 - google.com
echo 2 - Notepad.exe
echo 3 - calculator.exe
echo 4 - paint.exe
echo 5 - cmd.exe
echo 6 - time.exe
echo 7 - date.exe
echo 8 - xcopy.exe
echo 9 - wordpad.exe

CHOICE.EXE /C123456789/N" Type number between 1 TO 9: " 
  
:: following are 1.bat, 2.bat 3.bat etc
IF errorlevel=9 FOR %%c in (9.bat.BAT GOTO:loop) do %%c 
  
IF errorlevel=8 FOR %%c in (8.bat  GOTO:loop) do %%c 
  
IF errorlevel=7 FOR %%c in (7.BAT GOTO:loop) do %%c 
  
IF errorlevel=6 FOR %%c in (6.BAT GOTO:loop) do %%c 
  
IF errorlevel=5 FOR %%c in (5.BAT GOTO:loop) do %%c 
  
IF errorlevel=4 FOR %%c in (4.BAT GOTO:loop) do %%c 
  
IF errorlevel=3 FOR %%c in (3-BAT GOTO:loop) do %%c 
  
IF errorlevel=2 FOR %%c in (2.BAT GOTO:loop) do %%c 
  
IF errorlevel=1 FOR %%c in (1.bat GOTO:loop) do %%c 

:end

NOTE: keep all following files in c:\bat\ to run this batch file
name menu1.bat, choice.exe, plus batch files 1.bat, 2.bat, 3.bat, 4.bat, 5.bat, 6.bat, 7.bat ,8.bat ,9.bat .

Here I given two example  batchfiles.

@echo off
::give file name for this batch file name 1.bat
:: 1 - open ping google.com

ping google.com

call c:\bat\menu1.bat
:end

@echo off
::give file name for this batch file name 2.bat
:: 1 - open ping google.com

notepad.exe

call c:\bat\menu1.bat
:end

:: like creaat batch file for calculator.exe, paint.exe etc

More Parameters and detail description goto c:\windows\system32\choice.exe /?
---------

How to trace remote computer using IP address
or web URL:-

 Syntax 
  
  tracert  /d

Description:-

Determines the path taken to a destination by sending Internet Control Message Protocol (ICMP) echo Request  

What is the use of trace root :-

How to Use the Traceroute Command. Traceroute is a command which can show you the path a packet of information takes from your computer to one you specify. It will list all the routers it passes through until it reaches its destination, or fails to and is discarded.

d/     =   Prevents tracert from attempting to resolve the IP addresses of intermediate routers to their names. This can speed up the display of tracert results.

For more detail parameters  c:\windows\system,32\tracert/? 

Example:-

To trace the path to the host named corp7.microsoft.com, type:
tracert corp7.microsoft.com

Sample programmes:-

If you want to tracert for multiple remote computer then you can put it in
batch file.

Run this syntax in Dos command 

tracert google.com  

or   

tracert  typeIP address here

google IP address or URL is 8.8.8.8.8.8.

Is it legal to ping website:- 1 ping is absolutely legal. 100,000 at once and you might get in trouble.

Note:- It will list all the routers (from your computer to remote computer,)
it passes through until it reaches its destination, 

tracert /j 10.12.0.1 10.29.3.1 10.1.44.1 corp7.microsoft.com


---------
How to change color of Monitor

 Syntax 
  
 color 


Description:-

Changes the foreground and background colors in the Command Prompt 
use without parameter, restore default color.

Example:-

use color with 0 to 7 parameter 
0 is Black
Sample programmes:-

c:\main\color  04    
 
type the command in commond prompt prompt changes to light Red.

---------
How to pause batfile?

 Syntax 
  
  timeout 


Description:-

Pauses the batch file  for the specified number of seconds

Example:-

timeout 120
pause for 120 seconds

Sample programmes:-

@echo off
:start

timeout 180

xcopy c:\main\*.* c|main\tmn
:: backup all files and pause running batchfile180 seconds
goto start

---------------------------
How to open text file without using notepad


 Syntax 
  
  type | more 

Description:-

Controling screen display scrolling  page-by-page

Example:-

type | more   test.txt  

type (use pipe key above slash) test.txt
  

---------------------------
How to send message without using app.

 Syntax 
  
  msg 

Description:-

Send Message to user

Example:-

MSG {username | sessionname | sessionid | @filename | *}
[/SERVER:servername] [/TIME:seconds] [/V] [/W] [message]

username ---- Identifies the specified username.
sessionname ---- The name of the session.
sessionid ---- The ID of the session.
@filename ---- Identifies a file containing a list of usernames,
sessionnames, and sessionids to send the message to.
* ------Send message to all sessions on specified server.
/SERVER:servername ------server to contact (default is current).
/TIME:seconds ------Time delay to wait for receiver to acknowledge msg.
/V Display ------information about actions being performed.
/W ------Wait for response from user, useful with /V.
message------ Message to send. If none specified, prompts for it
or reads from stdin.


more parameter type msg/?
---------------------------

HOW TO BACKUP YOUR ALL DIRECTORY IN YOUR COMPUTER AND FILE NAMES:-

 Syntax 
  
  tree  /f

Description:-

Displays names of files in a directory, subdirectory files 

Example:-

tree  /f    >   c:\main\files.txt

/f = list all files in directory and sub directory.

open files.txt in notepad and check directory tree.

Note. Always check file path and run the programme

Sample Programme:-

@echo off

:: useful to take backup how many directory present in your computer 
:: useful to take number of files names present in your computer

c:\bat\ tree /f > test.txt :: to creat file and store
or
c:\bat\ tree /f >> test.txt

::display all directory and filenames after c:\bat directory
exit
---------------------------
How to display active TCP connection.

 Syntax
 
 netstat   

Description:-

Displays active TCP connections, Displays protocol statistics. Used without parameters, this command displays active TCP connection

Important:This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples:-

netstat   /a     
 
displays all TCP corrections

More Parameters and detail description goto c:\windows\system32\netstat/?

---------------------------
How to use -- if exist -- command

 Syntax
 
 if exist


Discription:-

Displays windows  output one screen at a time 

This programme shows how many text files are present in a directory. and -more- command
was included.

For more parameters type  more/?

Sample Programmes :-

@echo off
:: Displays windows  output one screen at a time 

@echo off if not exist *.txt ( echo This directory contains no text files. ) else ( echo This directory contains the following text files: echo. dir /b *.txt > c:\main\test.txt )
type c:\main\test.txt | more
:: pipe sign and more
:: give > or >> 
exit

Open output file name in a directory c:\main\test.txt and check how many text files are there in a directory. 
---------------------------
How check currently running programme?

 Syntax
 
 tasklist


Discription:-

 Display all currently running task including system. (eg task manager)

For more parameters type  tasklist/?

Sample Programmes :-

tasklist   |   more
or 
tasklist

::type this command on dos prompt, check how many programmes are running.
---------------------------

How to check windows version?


 Syntax 
  
 ver   


Discription:-

 Display windows version

For more parameters type  ver/?

Sample Programmes :-

ver

type this command in dosprompt.
---------------------------
How to close programmes?


 Syntax 
  
 taskkill   

Description:-
 
close running application in computer. eg. notepad.exe, paint.exe, wordpad.exe

Examples:-

taskkill.exe /im cmd.exe

taskkill.exe /im notepad.exe

this will close existing Dos prompt window and notepad

Sample programme 1 :-


---------------------------
How to check Remote server is working or not ?

 Syntax 
 ping tracert  

     

Description:-

Check the remote server is working or not:-

PING google.com

PING google.com >> c:\bat\test.txt

tracert:-

In the Command Prompt window, type 'tracert' followed by the destination, either an IP Address or a Domain Name, and press Enter. The command will return output indicating the hops discovered and time (in milliseconds) for each hop

Eg:   tracert google.com
or
tracert 8.8.8.8
---------------------------
Continued to page 03

PAGE 01

PAGE 02

HOW TO BACKUP YOUR ALL DIRECTORY IN YOUR COMPUTER AND FILE NAMES:-

HOW TO BACKUP YOUR ALL DIRECTORY IN YOUR COMPUTER AND FILE NAMES:-   Syntax         tree   /f Description:- Displays names of files in a dir...