How to do change "Terminate batch job (Y/N)?"

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Userdosfx
Posts: 13
Joined: 31 Aug 2019 14:13

How to do change "Terminate batch job (Y/N)?"

#1 Post by Userdosfx » 15 Oct 2019 10:19

i try to remove this prompt
i want to change it to paused for example
how to do that?

Userdosfx
Posts: 13
Joined: 31 Aug 2019 14:13

Re: How to do change "Terminate batch job (Y/N)?"

#2 Post by Userdosfx » 16 Oct 2019 11:24

i could do this ?

Szecska
Posts: 17
Joined: 15 Aug 2019 15:29
Location: Hungary

Re: How to do change "Terminate batch job (Y/N)?"

#3 Post by Szecska » 16 Oct 2019 14:47

It can be done but you have to handle all the keyboard input. There's the 'xcopy /w' and 'replace /w' methods for that(getting all the keys), I will link them later.
But if you just want a simple code, then it does not worth the effort.

Ps: In older versions, there's the break command wich turns off Ctrl+C totally. In windows, this feature isn't working.
Sets or clears extended Ctrl+C checking on DOS system.
Break syntax is present for compatibility with DOS systems. It has no effect under Windows.
If command extensions are enabled, and running on the Windows platform, then the BREAK command will enter a hard coded breakpoint if being debugged by a debugger.
---copied from computerhope.com

Szecska

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How to do change "Terminate batch job (Y/N)?"

#4 Post by ShadowThief » 16 Oct 2019 17:02

It's built into cmd.exe; you'd have to hex edit the executable to have it return a different string.

Userdosfx
Posts: 13
Joined: 31 Aug 2019 14:13

Re: How to do change "Terminate batch job (Y/N)?"

#5 Post by Userdosfx » 17 Oct 2019 04:33

Szecska wrote:
16 Oct 2019 14:47
It can be done but you have to handle all the keyboard input. There's the 'xcopy /w' and 'replace /w' methods for that(getting all the keys), I will link them later.
But if you just want a simple code, then it does not worth the effort.

Ps: In older versions, there's the break command wich turns off Ctrl+C totally. In windows, this feature isn't working.
Sets or clears extended Ctrl+C checking on DOS system.
Break syntax is present for compatibility with DOS systems. It has no effect under Windows.
If command extensions are enabled, and running on the Windows platform, then the BREAK command will enter a hard coded breakpoint if being debugged by a debugger.
---copied from computerhope.com

Szecska
I want code example

Userdosfx
Posts: 13
Joined: 31 Aug 2019 14:13

Re: How to do change "Terminate batch job (Y/N)?"

#6 Post by Userdosfx » 17 Oct 2019 21:33

Somebody?

Szecska
Posts: 17
Joined: 15 Aug 2019 15:29
Location: Hungary

Re: How to do change "Terminate batch job (Y/N)?"

#7 Post by Szecska » 18 Oct 2019 12:46

Here's an example:

Code: Select all

@echo off
setlocal enabledelayedexpansion && rem basic setup
for %%I in ("%cd%") do set odrive=%%~dI & if not %%~dI==%systemdrive% %systemdrive% & rem This line corrects the strange behavior of replace /w and xcopy /w on fat32 drives by changing the path to the system drive
:begin
for /f skip^=1^ delims^=^ eol^= %%A in ('replace ? . /u /w') do set key=^%%A & rem This gets a single character from the keyboard
if "!key!"=="<Ctrl+c here>" goto AboutToEnd & rem If the input equals with (0x03;the ctrl+c character), goes to the AboutToEnd  flag
goto begin

:AboutToEnd
choice /m "This is your message!(Y/N)" /c yn /n & rem type 'choice /?' to the command line for explanation
if %errorlevel%==1 exit /b
goto begin
You have to run this script synchronously with the original script, but I can't help you with that sadly :(
Ask some expert about it, personally I know that David (Dbenham) had dealt with this problem in his Snake game.

Szecska

Edit:I almost forgot: You have to insert a Ctrl+c character where i labelled, I recommend using some sort of hex editor to do that. Also the script wasn't tested yet.

pieh-ejdsch
Posts: 239
Joined: 04 Mar 2014 11:14
Location: germany

Re: How to do change "Terminate batch job (Y/N)?"

#8 Post by pieh-ejdsch » 19 Oct 2019 00:56

Hallo Userdosfx,

I do not know what you exactly want.
I hope you know exactly what you want.
Describe at least what you plan and what should be different.
Do you want to abort the script and suppress the message?
Do you want to pause - then use the pause command or the pause key.
https://administrator.de/forum/1-progra ... ent-764408

Phil

Post Reply