1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? Bat Works but BTM Doesn't

Discussion in 'Support' started by Iram, Nov 18, 2014.

  1. Iram

    Joined:
    Nov 18, 2014
    Messages:
    2
    Likes Received:
    0
    Can anyone help me understand why?

    The purpose is to fix the taskbar that won't hide in Win7. Here's the code

    g:\utils\pstools\pskill explorer.exe
    start explorer.exe
    exit

    I'm running TCMD16
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    Is it possible that you're restarting Explorer before it is finished shutting down? You might try putting a DELAY 2 after the PSKILL. (And you could probably replace the PSKILL with a TASKEND /F.)
     
  3. Christian Albaret

    Joined:
    Jul 1, 2008
    Messages:
    154
    Likes Received:
    1
    .BAT and .CMD script files are read line by line, with the file being closed and reopened each time (this allows for the now-obscure feature of self-rewriting scripts, and in the Dos/Command.com days allowed installing TSRs), while .BTM script files are read once into memory (BTM stands for "Batch To Memory; TCC still has to old LoadBtm command). This yields a difference in speed, which could explain the difference in behavior, because, as Charles Dye points out, the process may not have disappeared completely from the system at the time PsKill returns.
     
  4. Iram

    Joined:
    Nov 18, 2014
    Messages:
    2
    Likes Received:
    0
    I have the btm file on my desktop. It works under these conditions 1) if I open a tcmd window and then run the btm from the commandline or 2)if I right click the icon and select open with TCC. If I just click on the btm or right click and select open with TCMD, , TCMD opens , and stays open. The btm does not run. I've added delays and echo statements, so I'm sure it does not run.
     
  5. Christian Albaret

    Joined:
    Jul 1, 2008
    Messages:
    154
    Likes Received:
    1
    The issue seems to be related to the way you execute it, not to the contents of the script. Your original title stated there was a difference between .BAT and .BTM scripts, but you are not talking about it anymore.
    The script has to be eventually executed by TCC (the console and interpreter). This is what happens with (1) and (2).
    Unfortunately I am not used to the other methods. I never installed the file association with tcmdbatch.btm (which seems to associate script files with: "[path]\tcmd.exe" /c). If you run by (double-)clicking, the execution should be triggered by the Windows associations (check with the ASSOC and FTYPE commands). I don't understand where the "right click and select open with TCMD" can come from; has this been installed from something delivered by JP Soft, or did you choose TCMD in the "Select a program to open this file" dialog (I get this dialog if I run in TCC: "[path]\tcmd.exe/c somescript.btm)? In the latter case, it would sound as if you wrongly selected TCMD (the graphical interface that displays a console (TCC or any other console) in a tabbed Window) and not TCC. There are so many ways to configure the file associations…
    When I want to have TCMD open and execute a script, I create a shortcut with a target in the form: "[path]\tcmd.exe" /t "[path]\tcc.exe" /k myscript.btm, i-e I specify both TCMD and TCC.
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    I don't think that anything Rex provides, creates an "Open with TCMD" shell verb. It would be interesting to know (a) where that verb came from, and (b) what its contents are. Would probably take some digging through your registry to figure it out.

    It might have been created by Explorer: http://technet.microsoft.com/en-us/magazine/ee851670.aspx
    If that's where it came from, this shell verb just passes the filename of the batch file to TCMD.EXE without any further options -- and it will certainly be useless.
     
  7. Christian Albaret

    Joined:
    Jul 1, 2008
    Messages:
    154
    Likes Received:
    1
    Coming back to the original problem: "BAT Works but BTM Doesn't".
    When you (double-)click on a .BAT file, or when you select OPEN from the right-click menu, it is passed to CMD for execution. This is Windows standard and obviously works.
    You probably tried to create the association for .BTM files, but directed it to TCMD. This does not work, but it should work if you direct to TCC, or (according to what I see in tcmdbatch.btm) if you manage to add a /C option for TCMD.
    Personally I try and avoid these associations: they are system-wide, and too concealed. It is difficult to revert or to edit something once the association is made. Unless you take special steps (e-g setting up a version-independent junction to the directory), the association will point to a specific version (e-g "C:\Program Files\JPSoft\TCMD16x64\tcmd.exe").
    I prefer setting up shortcuts individually on a file by file basis.
    Concerning your specific file (pskill+start explorer): no part of it requires TCC, you can give it a .BAT extension and have it executed by CMD.
     

Share This Page