Author Topic: Unexpected temporary .tmp.bat file opened in local AppData folder...  (Read 538 times)

gfinlay

  • Community Member
  • Posts: 10
  • Hero Points: 0
Hi,

I'm using SE Pro 2017 v22.0.0.9 64-bit. 
I find that SlickEdit repeatedly opens a window/buffer attached to a temporary batch file. 
e.g. C:\Users\<username>\AppData\Local\Temp\tmpB291.tmp.bat.
This is unexpected. The contents of the batch file are typically something like:
ping 1.1.1.1 -n 1 -w 1000
set /a waitCount=0
:Reattempt
set /a waitCount+=1
if %waitCount% gtr 60 goto :eof
If EXIST %1 (
ren %2 %3
move /Y %1 %2
ping 1.1.1.1 -n 1 -w 1000
GOTO Reattempt
) ELSE (rd "%~dp1" /s /q
move /Y %4 %5)
del %0


Any ideas what is causing this?

Thx,
Gord

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4393
  • Hero Points: 327
Re: Unexpected temporary .tmp.bat file opened in local AppData folder...
« Reply #1 on: December 05, 2017, 02:37:16 am »
Have you loaded any custom macros? While SlickEdit does on rare occasion generate temp .bat files, this one doesn't look like anything SlickEdit created and I searched our source code for snippets of this code and can't find it anywhere.
« Last Edit: December 05, 2017, 03:22:21 am by Clark »

mwb1100

  • Senior Community Member
  • Posts: 145
  • Hero Points: 13
Re: Unexpected temporary .tmp.bat file opened in local AppData folder...
« Reply #2 on: December 07, 2017, 01:21:56 am »
HP seems to use a similar batchfile for something-or-other.  Is your machine an HP computer by any chance?

  - https://h30434.www3.hp.com/t5/Notebook-Operating-System-and-Recovery/Strange-bat-file-execution-attempt-by-HPResources-exe/td-p/3406769

It looks like a batch file that is intended to wait until something is finished (as detected by "%1" no longer existing), then removing the directory that contained that file ("%~dp1") and everything in it.

Also some files are moved around. 

If I had to guess, this would be something that's part of an uninstall (or maybe install) routine.  If you can edit the file, perhaps add a line like the following after ":Reattempt" to see if anything useful shows up:

Code: [Select]
echo "%1" "%2" "%3" "%4" "%5" >> c:\temp\unknown-batch-file-args.txt

You might have to do it within 60 seconds of when it gets created - assuming it gets run more or less immediately after it gets created.

gfinlay

  • Community Member
  • Posts: 10
  • Hero Points: 0
Re: Unexpected temporary .tmp.bat file opened in local AppData folder...
« Reply #3 on: December 21, 2017, 11:01:01 pm »
@mwb1100  Thanks. Your suggestion about what application was creating these batch files was absolutely correct.  There was a temporary batch file created at the beginning of every Windows login by the HP Support Assistant in my AppData folder. 
Normally this would not be a problem. But for some reason, I had Windows file associations by extension configured to associate .bat files with slickedit (vs.exe).  If SlickEdit was already running, the HP Support Assistant was invoking the batch file in a way that would use the default application for the extension to open the file - hence it would open the .bat file in SlickEdit instead of running the batch file normally.

It took me a while to figure out how to edit my registry with RegEdit to remove the association of .bat files with SlickEdit.  The Windows GUI hides file extension associations for executable files (.exe and .bat files), so it is difficult to remove .bat file associations through Windows Settings.

Thanks,
Gord