Page 1 of 1

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

Posted: 15 Oct 2019 10:19
by Userdosfx
i try to remove this prompt
i want to change it to paused for example
how to do that?

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

Posted: 16 Oct 2019 11:24
by Userdosfx
i could do this ?

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

Posted: 16 Oct 2019 14:47
by Szecska
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

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

Posted: 16 Oct 2019 17:02
by ShadowThief
It's built into cmd.exe; you'd have to hex edit the executable to have it return a different string.

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

Posted: 17 Oct 2019 04:33
by Userdosfx
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

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

Posted: 17 Oct 2019 21:33
by Userdosfx
Somebody?

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

Posted: 18 Oct 2019 12:46
by Szecska
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.

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

Posted: 19 Oct 2019 00:56
by pieh-ejdsch
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