Unexpected 'Cancel Batch Job' prompts

ron

Aug 19, 2008
151
0
Going from 13.x to 16.x, have a BTM that's giving me unexpected prompts when run. For now I've reinstalled 13.x side by side to see if it's definitely related to 16.x.

:sub0
echo Moving files in %_cwd...
for %x in (*.jpg) gosub sub1
return
:sub1
if not exist "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]" md /s "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]"
move %x "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]"
return


When executed, I get several of these...

Cancel batch job C:\bin\movesnaps-NS.btm ? (Y/N/A) : N

I answer N, the job continues. In a few seconds I'll get it again. This is running at 3am when no one is at they keyboard.

The prompts occur at the same point each time.

Any ideas?
 
Last edited:
May 20, 2008
11,400
99
Syracuse, NY, USA
I don't know about the prompts, but you should also be getting errors because of the first "return". There, you're not in a subroutine, so there's nothing to return from. You should see the "Missing GOSUB" message. Use QUIT instead.
 
Apr 2, 2011
1,441
10
54
North Carolina, USA
Going from 13.x to 16.x, have a BTM that's giving me unexpected prompts when run. For now I've reinstalled 13.x side by side to see if it's definitely related to 16.x.

echo Moving files in %_cwd...
for %x in (*.jpg) gosub sub1
return
:sub1
if not exist "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]" md /s "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]"
move %x "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]"
return


[omitted...]

Why not remove the IF NOT EXIST test and just use

MOVE /MD /R %x "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]"\

???
 

ron

Aug 19, 2008
151
0
I don't know about the prompts, but you should also be getting errors because of the first "return". There, you're not in a subroutine, so there's nothing to return from. You should see the "Missing GOSUB" message. Use QUIT instead.

My bad, that's just a snippet of the entire BTM and I left out a key part :-) - now edited.
 

ron

Aug 19, 2008
151
0
Why not remove the IF NOT EXIST test and just use

MOVE /MD /R %x "f:\Archive - NS\%@word["\",2-3,%_cwd]\%@year[%@filedate[%x]]\%@month[%@filedate[%x]]"\

???

Will MOVE /MD create any sub folders like MD /S ?

Let's say the folder \garage\2014 exists. On 1/1 I'll need \garage\2015\1.
 

ron

Aug 19, 2008
151
0
More weirdness, I'm moving a bunch of JPG's from a folder populated via the cloud to another folder structure on the same drive and stored in folders based on the year/month of the JPG.

So I've got two different repositories that get populated and running the BTM on one doesn't exhibit the problem whereas it does consistently at the exact same point when moving from the other path.

Currently both paths are just empty folders since the population takes place over night. So it quickly runs through the paths with nothing to do. One path causes the batch to present the Cancel Batch Job message, the other doesn't. The BTM is run separately for each path.

Presumably the mechanism that looks for Ctrl-C is seeing that while the job is running - and that's the only circumstance in which that message would be displayed?
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I imagine other signals (than Ctrl-C) could trigger the prompt. When this is running at night, is there any hibernating or similar inactivity going on? Is the job a scheduled task ... or something that might trigger a logoff of the user owning the process?
 

ron

Aug 19, 2008
151
0
I think I've got it working. The part of the BTM above the subroutines above is just a bunch of hard coded CD <some_path>. This batch file originated long ago. I should re-write it to just process what folders are there instead of maintaining the list. In the beginning, there were only two folders :-)

Back to my issue. Turns out, one of the paths I was CD'ing to did not exist.

When running the batch file...

TC11 - reports the path does not exist and identifies the line in the batch file containing the CD command
TC13 - crashes. Actually, just closes the window.
TC16 - Prompts if I want to cancel the batch job
 

ron

Aug 19, 2008
151
0
I imagine other signals (than Ctrl-C) could trigger the prompt. When this is running at night, is there any hibernating or similar inactivity going on? Is the job a scheduled task ... or something that might trigger a logoff of the user owning the process?

The job is executed as a post action of another scheduled task. About the only thing that's running over night is backups. But it was popping up on demand yesterday. Looks like trying to CD to a non-existing folder was causing it - but only in v16, v11 reports the folder doesn't exist and continues the batch.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
The job is executed as a post action of another scheduled task. About the only thing that's running over night is backups. But it was popping up on demand yesterday. Looks like trying to CD to a non-existing folder was causing it - but only in v16, v11 reports the folder doesn't exist and continues the batch.
I don't think a missing folder can cause the "Cancel batch" prompt. I think that prompt can only come from a "signal" (notably, but not only, CTRL_C_EVENT). [Maybe Rex will chime in here.] If the batch file is running as a "post action of another scheduled task" (I'm not sure what that is) it might be getting the signal CTRL_LOGOFF_EVENT. That signal could evoke the "Cancel batch" prompt. You could check the Security event log to see what logons/logoffs happen when your tasks are run.
 
Apr 2, 2011
1,441
10
54
North Carolina, USA
Cool. Since MD has a parm to enable that feature and MOVE didn't, I assumed I needed to stick with MD /s to create multiple paths. Thanks for the tip!

If you wanted to post your BTM file - I'd be glad to see if it can be tweaked any....
 

ron

Aug 19, 2008
151
0
Looks like it was a problem with jpstree.idx. My config is such that CD to a non-existent directory will cause it to search the index. That path in the code was what crashed 13 and caused the prompt in 16. Today I was having problems getting CDD to work and ended up re-building the .idx. Now CDD works again and when running my BTM, v16 (like v11) reports the non-existent directory when it encounters one instead of issuing the do I want to cancel prompt.
 
Similar threads
Thread starter Title Forum Replies Date
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
vefatica @FILESIZE[] ... allocated ... unexpected results Support 0
T WAD Strange Unexpected "features" in the Debugger Support 2
Mike Hall Unexpected "Variable loop" in IF condition Support 10
rps How to? dir /s unexpected results Support 10
A How to? PhraseExpress autotext/autocompletion printing unexpected characters Support 4
S Unexpected error report Support 7
D Unexpected behavior Support 8
H TPIPE: /FILTER and /OUTPUT unexpected incompatibility Support 6
M How to? Work around an unexpected and very inconvenient behavior of TCC... Support 26
M Unexpected Results from Doing Numeric Comparisons... Support 17
F unexpected %1 while starting ide Support 6
vefatica @SERVICE, unexpected results Support 6
Emilio III Unexpected file deletion Support 30
S RECYCLE /P - unexpected behavior Support 0
I on error[msg] unexpected behaviour Support 0
S incorrect message at start Cancel batch job 4START.bat ? (Y/N/A) : Support 1
A 18.00.21 tries to cancel TCSTART.BTM Support 3
vefatica Fixed DO, OSD, and cancel batch prompt Support 3
vefatica Cancel batch prompt? Support 0
fpefpe How to? shortcuts and batch files Support 4
vefatica `Back quotes` - command line vs. batch file Support 5
fpefpe How to? batch file size Support 2
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
P Kill all other instances of tcc from a btm batch file Support 2
fpefpe batch file ending early Support 18
R Batch Debugger Command Expansion Window Support 3
K robocopy cancelling batch file processing Support 28
A Unable to pass batch file arguments unaltered Support 18
K Batch debugger not stepping correctly Support 4
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
Joe Caverly "Functions" in cmd.exe batch files Support 6
S Batch files Calling Batch Files Support 2
P exit /b in batch files Support 7
P Labels in batch files: TCC vs CMD.exe Support 9
vefatica Batch parameters broken? Support 2
cxxl Set encoding for batch file Support 4
dcantor How to? Batch file to be executed by TCSTART Support 4
J New lexer for TCC batch files. Support 0
T Fixed Problem with use of Batch parameters in the IDE Support 1
T Fixed IDE locks up if edit window for running batch is closed Support 6
T How to? Show the values of batch variables on the TCC screen Support 21
D Alias in batch file Support 3
TT's Help! Uninstalling TCC did not restore cmd.exe as Win10 default batch file processor. Support 4
vefatica Exit code of a batch file? Support 4
J cd command altered in batch file Support 3
MickeyF running a program from cmdline versus in batch file Support 1
B Batch file won't run if there is already an instance of TC 17 running Support 9

Similar threads