When I cancel the batch via Ctrl+C The first row deleted

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
karzer
Posts: 21
Joined: 17 Jul 2010 02:56

When I cancel the batch via Ctrl+C The first row deleted

#1 Post by karzer » 25 Nov 2010 05:59

When I cancel the batch via Ctrl+C. The first row of the sheet is being deleted(route print). How can I perevent deletion?

Code: Select all

@echo off
set /p IP=
FOR /L %%G IN (0,1,255) DO route delete %IP%.%%G
exit

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: When I cancel the batch via Ctrl+C The first row deleted

#2 Post by jeb » 25 Nov 2010 06:13

Hi karzer,

test the content of IP

Code: Select all

@echo off
set "IP="
set /p IP=
if "%IP%"=="" (
  echo Nothing entered or CTRL-Break
  goto :eof
)
FOR /L %%G IN (0,1,255) DO route delete %IP%.%%G
exit


jeb

karzer
Posts: 21
Joined: 17 Jul 2010 02:56

Re: When I cancel the batch via Ctrl+C The first row deleted

#3 Post by karzer » 25 Nov 2010 07:03

Thank you, but I pexec it (remcomm) Deleting the first line with the distance I run.
I wonder how the function of ctrl + c to cancel and quit.

remcomm / / host batc_file

Post Reply