Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to suppress "terminate batch job (Y/N)?"

2,744 views
Skip to first unread message

Cesar Romani

unread,
Dec 31, 2014, 12:38:19 AM12/31/14
to
I have the following batch file:

----------
@echo off
C:\djvu\pdf2djvu.exe %*
----------

and I cannot put C:\djvu in the PATH

Each time I interrupt the batch file, with CTRL-C, when it is running, I
always get:
terminate batch job (Y/N)?

How can I suppress it?

I was told to use:
start "dummy" /b C:\djvu\pdf2djvu.exe %*

but when I call the batch without parameters, it always pauses and I
have to press ENTER to get to the cmd shell.

Many thanks in advance,

--
Cesar

frank.w...@gmail.com

unread,
Dec 31, 2014, 4:37:45 AM12/31/14
to
From CesarRomani:
>----------
>@echo off
>C:\djvu\pdf2djvu.exe %*
>----------

>... when I call the batch without parameters, it always pauses and I
>have to press ENTER to get to the cmd shell.

Try:

----------
@echo off
IF "%*" EQU "" (
start "dummy" /b C:\djvu\pdf2djvu.exe
) ELSE (
start "dummy" /b C:\djvu\pdf2djvu.exe %*
)
----------

I don't run Windows so I can't test that.

Frank

Cesar Romani

unread,
Dec 31, 2014, 6:51:01 PM12/31/14
to
Thanks Frank, but it doesn't work. When I call it without arguments, I
always have to press ENTER to get to the cmd shell.

Regards,

--
Cesar

Todd Vargo

unread,
Jan 1, 2015, 1:39:56 AM1/1/15
to
AFAIK, you can not suppress the "terminate batch job (Y/N)?" message.
Using START opens a separate window and returns immediately to the batch.

My search results indicate that pdf2djvu.exe is a Trojan horse. You need
to provide much more details about what you are doing and why.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

Frank P. Westlake

unread,
Jan 1, 2015, 9:12:50 AM1/1/15
to
On 12/31/2014 03:50 PM, Cesar Romani wrote:
> frank.w...@gmail.com wrote:
>> ----------
>> @echo off
>> IF "%*" EQU "" (
>> start "dummy" /b C:\djvu\pdf2djvu.exe
>> ) ELSE (
>> start "dummy" /b C:\djvu\pdf2djvu.exe %*
>> )
>> ----------

> Thanks Frank, but it doesn't work. When I call it without arguments, I
> always have to press ENTER to get to the cmd shell.

I don't understand your problem because of your wording, and I can't
test my suggestions, and my memory of this language is fading, but try
this:

----------
@echo off
IF "%*" EQU "" (
start "dummy" C:\djvu\pdf2djvu.exe
) ELSE (
start "dummy" C:\djvu\pdf2djvu.exe %*
)
EXIT
----------

The change is the addition of the command EXIT and the removal of the
background switch (/b). If "pdf2djvu.exe" is a Windows application then
it doesn't need to be sent to the background, and if it is a console
application then sending it to the background will not allow the console
window to close before the application has finished. If it is a console
application then you are stuck with the console window unless you use a
third party program (or maybe CScript) which hides the window.

Frank

Cesar Romani

unread,
Jan 1, 2015, 10:25:53 AM1/1/15
to
Yes, I can suppress it using 'start' on the batch!
pdf2djvu is only an example, you can use whatever executable you want.
I think I already described what I was doing: To put an executable in a
batch file, as in:

gfind.bat
=========
@echo off
C:\gnuwin32\find.exe %*

If I'm issuing, say 'gfind . -name "*.txt"' and I interrupt it with
CTRL-C I get:
terminate batch job (Y/N)?

How to suppress it and get directly to cmd, as with a normal executable?

Using 'start' I don't get this message, but then I have other problems.

foxidrive

unread,
Jan 2, 2015, 11:59:31 AM1/2/15
to
On 2/01/2015 02:25, Cesar Romani wrote:

> How to suppress it and get directly to cmd, as with a normal executable?

Alt+space and C works for me.



giovann...@gmail.com

unread,
May 6, 2016, 12:21:27 PM5/6/16
to
you may do this in your batch:
----------------
@echo off
C:\djvu\pdf2djvu.exe %* & exit
--------------
The 'exit' command leave the batch before sending the prompt.
the drawback is that even the command is closed. If you want to keep it,
run in this way

CMD /C MyBatch.bat

then the exit close only the second instance of cmd.
0 new messages