DOS/External tool does not delete temporary .bat file

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
Cloink
Posts: 81
Joined: Thu Sep 09, 2004 1:44 pm

DOS/External tool does not delete temporary .bat file

Post by Cloink »

Hi,

When TextPad runs an external DOS command, it creates a tiny TPxxxxxx.bat batch script, and runs that.

I use TextPad frequently on my home laptop, for which I have admin rights, and on my work laptop, where I do not have admin rights (admin rights may or may not be relevant).

Work TP version is 8.4.0, home version is 7.6.4.

I have never noticed any temp .bat files un-deleted on my HOME laptop*, but on my WORK laptop they are consistently NOT being deleted.

If I try and delete manually, Windows tells me something else has them open.

Even if I close down TP, I still cannot delete the temporary .bat file/s. Only after a reboot can I delete them. It's not a big issue, but these files are in a common network location where they take up space (however small), and might be seen by other members of the dept.

What do my external tools do? Home and work follow the same principle (but are different):-

Run my own .bat script, with filename macros etc passed as arguments on the command line.

This in turn runs/connects to Oracle's sqlplus executable - which is a script-able command line interface to issue sql commands to an Oracle database. Work: connect using tnsnames.ora; home: direct connection to XE.

My own .bat file, in this mode, issues a DOS PAUSE command, so I can review the output before it terminates.

I run the self-same .bat file as a 'Captured' tool so the output is captured by TextPad in the Tool Output window.

Only when I run as the external tool does TP's temporary .bat file NOT get deleted. (It was probably never created in the first place for the 'internal' tool.)

Does anybody know what process has hold of the temp .bat files and if it is possible to make sure they DO get deleted?

*I have realised I only run as captured tool on my home laptop, so that might explain why I don't see them on personal use.

Thanks for any suggestions!
Clark
User avatar
AmigoJack
Posts: 533
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

If you know the filename then search for them using Mark Russinovich's HANDLE - it will list the process(es) that are currently using that file. Just run it and analyze the output, i.e.

Code: Select all

handle tpxxxxxx.bat

However, that tool needs administrator privileges, so first try it at home. The Process Explorer might work without administrator privileges and incorporates displaying/searching for open handles, too.
User avatar
Cloink
Posts: 81
Joined: Thu Sep 09, 2004 1:44 pm

Post by Cloink »

Thanks AmigoJack, but I'm afraid the problem does not occur on my personal laptop, so I can't use handle to try find the root cause outside of my work machine.

And we don't have Process Explorer at work, only Process Viewer which does not provide a filter/search option.

I had a weird cmd.exe problem on a prior work machine here, where new attempts to use cmd.exe would hang after an earlier use.

I have sometimes seen in Task Mgr a rogue 'Console Windows Host' process left active after the actual window has disappeared, which I think will be related -- although killing those still did not release the .bat file to be able to delete it.

Does anybody else have any ideas or suggestions?

TIA - Clark.

PS. Slightly more info here: https://stackoverflow.com/questions/136 ... nning-java
Post Reply