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

How to install and run TCMD as a regular user (without administrative privileges)

Discussion in 'T&T - Miscellaneous' started by MaartenG, Sep 10, 2016.

  1. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    OR: How to run multiple TCMD versions side-by-side as a regular user


    I found out you don't need administrative rights to install and run TCMD. You don't even have to install TCMD to make it run!
    Here's how (based on 64-bit Windows/TCMD, TCMD version 20 and path "C:\Maarten\Multi_TCMD"; change these to your situation):

    • Download a version of TCMD.exe (I tried versions 20, 17 and 11)
    • Rename tcmd.exe to tcmd_20.exe (to differentiate between multiple versions)
    • Execute: tcmd_20.exe /extract:"C:\Maarten\Multi_TCMD"
    • In folder "C:\Maarten\Multi_TCMD" rename the folder 56693B3 (this is different for every TCMD version) to TCMD_20
    • CD to TCMD_20
    • Run tcc.exe (or tcmd.exe)
    You will notice that it asks for adminstrative priviliges to run "something" elevated.
    If not: TCMD is already installed on this machine.

    • Abort / Exit
    This "something" turns out to be the registration of islicense50.dll (TCMD 11: islicense40.dll).

    The registration info is in the DLL itself and will get written to HKEY_LOCAL_MACHINE (HKLM)\Software\Classes.
    But when it gets read, it gets read from HKEY_CLASSES_ROOT (HKCR). That's how Windows works. Well, at least since Win2000

    HKCR is not your regular reghive. It is HKLM\Software\CLASSES *PLUS* HKEY_CURRENT_USER (HKCU) \Software\Classes, where the value in HKCU supersedes the HKLM value.
    So, I traced the the HKLM\Software\Classes keys of islicense50.dll, converted them to HKCU keys and put those in the registry instead.
    Now, when I start TCC.exe again, it starts without asking for administrative privileges and gives me the TCC prompt.
    So far, so good.


    Because it is not quite trivial to trace these regkeys - and these will vary upon different versions of the DLL - I searched the internet for a tool that could extract these regkeys.
    That way I could convert them (with search and replace) to HKCU keys and import those.
    That was the plan at least, but: No luck!

    But what I did find was even better: a tool that "reads" the DLL and registers the keys automatically under HKCU instead of HKLM!

    It's called RegSvrEx. It is not perfect. It doesn't extract and register all the keys, but the ones missing (Classes\Interface and Classes\TypeLib) aren't really neccessary, anyway. CLSID and APPID are the most important and they do get extracted.

    • Download RegSvrEX (size: 7KB) through [title] (click the "binary" link)
    • Put it in "C:\Maarten\Multi_TCMD"
    • CD to "C:\Maarten\Multi_TCMD\TCMD_20"
    • Run: "..\RegSvrEx.exe" /c IsLicense50.dll
    You might get errors. Ignore them

    • Start tcc.exe (or tcmd.exe)

    Now you can use TCMD.
    Afterwards unreg islicense50.dll (the HKCU keys, that is):

    • Run: "..\RegSvrEx.exe" /c /u IsLicense50.dll
    You might get errors. Ignore them



    Remarks

    - If you use Everything.exe, you probably have to RegSvrEx this too.

    EDIT: Turns out this is not needed. See one of the posts below on how to run Everyting as a regular user, too.


    Assumptions

    Some assumptions which I haven't tested or could not test

    • 64-bit vs 32-bit
    This is tested for 64-bit TCMD on Win7 and Win10. For 32-bit you probably just have to copy the files in the 32-bit subfolder to the main folder, download the 32-bit version of RegSvrEx.exe ([title]) and repeat the process.

    • Regular TCMD installation
    This can also be used next to a regular TCMD installation:
    If you are only using a regular installed TCMD, it will write (and read) the keys from HKLM (there are no HKCU keys..).
    If you follow the "installation" above, there WILL be HKCU keys, so these are the new values that will get read by every TCMD version (that is using islicense50.dll)

    As far as I monitored, these regkeys are only read upon starting TCMD. So next scenario will work:
    • Start "regular" TCMD: keys get read hrom HKLM --> regular TCMD starts
    • Start "floating" TCMD version x: X keys are written to (and read from) HKCU --> floating TCMD X starts
    • Start "floating" TCMD version y: Y keys are written to (and read from) HKCU --> floating TCMD Y starts
    • Exit all 3 TCMD's
    The scenario that might not work is where you first start "floating" TCMD X and then "regular" TCMD: "regular" TCMD then reads the HKCU TCMD X keys, which might be the wrong ones.

    • Licensing
    The only disadvantage I found so far, is probably the licensing.
    After 30 days with an unregistered copy, you are probably no longer allowed to start TCMD ( don't know yet; still 21 days to go ..).
    I found a way to circumvent this (keep it at 30 days), but will not make it public (or private; so no need to ask).
    Everyone should just buy a copy; it's a great product.

    Don't know what will happen when you have a "real" license. As far as I can see, registration can be done in userspace, so no admin rights needed. I would love to hear if this works out OK. Would be perfect for an USB-stick or similar.
     
    #1 MaartenG, Sep 10, 2016
    Last edited: Mar 19, 2017
  2. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    564
    Likes Received:
    8
    Outstanding! I had all the extract stuff figured out, but the registry portion was eluding me. Good job.

    @rconn : Going to run with this for couple of weeks to make sure it continues to work. If so, you will be able to thank @MaartenG for my first upgrade since TCMD17. I've been stuck with TCC/LE since about halfway thru TCMD17 due to my work upgrading from WinXP to Win7 when I got locked out.
     
  3. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    ... and an extra: "Installation" of Windows Explorer context menu's as a regular, non-elevated user.

    For now it will only work on Windows 7. Still working on making this usable under Windows 10 (see remarks at the bottom)

    Initially I went all out with submenu's, printing, editing .. , but eventualy reduced it to a much simpler version:
    - Right-click on a .btm gives you the possibility to open it in TCC or TCMD.
    - What happens on double-click can be configured in the script itself.
    - Shift-rightclick gives you also the option to debug (ide) or run elevated.
    - In a folder you can "open TCC or TCMD here" (right-click on an empty part of the content pane)

    Pictures:

    Capture1.JPG Capture2.JPG

    Running the script is pretty harmless: it adds a few new Current User registry keys and changes only one. It does include an "Undo" function:
    The first time you run the script, it will make a backup and then inserts the keys.
    The second time you run the script, it detects that it was run before and offers you a choice:

    Code:
    C:\Temp\ff\pu\TCC_20.0.20>ContextMenu.cmd
    
    
    
            You already added Take Command to the Explorer context menu.
            Do you want to (R) re-register (U) unregister or (Q) quit?
    
    Your choice  : [R,U,Q]?
    
    
    If you unregister, all the added keys are removed and the original settings are restored.


    Some remarks:
    • At this moment the script will only function on Windows 7 (and maybe Vista). Will not work in XP.
    • Windows 10 tries to protect the integrity of "file associations" by changing the permissions on the registry keys. Beyond that: it adds some base64 hash to verify the integrity.
      This was done to make sure the settings are changed through the GUI (Open with > Choose another app interface) so it can't be tampered with programmaticaly. So, right now this context menu is considered not working under Windows 10.
      It looks like I found a way to circumvent all this, but it still needs a lot of testing and optimizing. To be continued ...
    • It does not make use of regular file associations, so it is quite possible that you can't start a .btm right away from other filemanagers/shells (like FAR Commander and the likes) that depend on those.
    • I kept away from .CMD. ".cmd" is one of the few filetypes where you can't change the executing program through the Properties-page (same goes for .exe and .com; .dll can be changed, though).
      That can be hacked (of course; it is Windows), but not this time.
    • The script needs to be placed in the TCMD folder alongside the executables (tcmd.exe, ide.exe, tcc.exe). It can be run with CMD.exe
     
    #3 MaartenG, Sep 29, 2016
    Last edited: Sep 29, 2016
  4. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    Sorry, forgot to attach the script (did no one notice?)
    Windows 10 version of the script is roughly working; script will follow soon.
     

    Attached Files:

  5. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    564
    Likes Received:
    8
    So after working fine for a couple of weeks I purchased the upgrade. At the end of @MaartenG 's install instructions (before remarks and assumptions),
    However, after applying the Activation Key, isLicense50.dll must still be registered in order for TCMD/TCC to operate in full mode.

    So I did that and now it's happy. And so am I! :woot:
     
  6. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    Good to know! Thank you for trying this out. And I'm glad it helped someone ...

    I should have been more clear about unregistering: it is not needed when you keep using Take Command. It is only needed when you want to bring the system back to it's original state (e.g: after testing). But you already found out :-)
     
  7. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    As the Win10 version will build upon the Win7 version of this script, I decided to wait with the "release" of the Windows 10 version until I get some feedback for the Win7 version. Otherwise it would be error-on-error, which makes it hard to debug. Not that I found errors on the systems where I tested this...

    To be clear: you could use (or test) this context-menu even when you have a "regular" installation of Take Command.
     
  8. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,016
    Likes Received:
    0
    I used the script for the first time - I think it should remind the user what the script does and give them the choice to continue or quit.

    Also - the :EOF label does not exist -

    HKEY_CURRENT_USER can be abbreviated HKCU
     
  9. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    Charles G, thanks for testing this and giving feedback! Really appreciated!

    Something like that will certainly come (in one form or another). Just like this version is very "happy flow": hardly any checking on dependencies, errors or prerequisites. That has to be taken care of, too.

    :EOF (End Of File) is CMD's version of what we know as QUIT, CANCEL or RETURN (depending on the context). It is an "implicit" label.
    Take Command's Help-page explains it much better:

    For compatibility with CMD, the command GOTO :EOF will end processing of the current batch file if the label :EOF does not exist.

    Thanks. I prefer the HKCU version also. But as I don't know if all the tools I'm going to use will support the short HKCU version, most of the times I still end up with the long names...


    In this case the script is just a simple vehicle to transport some registry keys. I wonder if it gives you the context menu as intended?
     
  10. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,016
    Likes Received:
    0
    Yes it did work as intended I believe.
     
  11. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    361
    Likes Received:
    8
    Running Everything as a regular user, too

    It is possible to use Everything with a restricted account.
    It can't hook itself in Explorer to get changes in real-time (like a virusscanner: "on access"), but "on demand" with a little bit of "on access" is doable.

    Everything has a feature that let you scan folders (and thus update the index) on a schedule. It's in Options, under "Folders". Some folders you don't want to index can be configured under "Exclude".

    2017-03-19 11_19_27-Everything Options.png

    The "Attempt to monitor changes" is interesting: Changes made or seen by a currently opened Explorer (file manager, that is) are directly added to the Everything database. So, if I'm in TCC doing echo.>C:\dummy.txt and Explorer is opened in C:\, dummy.txt is added to the index rightaway. If Explorer isn't opened or opened in a different folder, you'll have to wait for the scheduled scan to pick up on it.


    You want Everything.exe to run all the time so it can keep updating the index, even if TCC isn't running. That can be done by adding the command everything.exe -startup to your (HKCU) Run key. (Or add it to your startmenu's StartUp folder, or ..)

    I wrote an installer.btm for it. You could use it to configure Everything. (put it in your TCMD foler, run it and your database will be build and is accessible from within TCC). It is "plug 'n' play", but it's main intention was to prevent me from describing "all" the options that had to be set (I like being lazy ;-).

    Some remarks

    • If you run the install.btm, it will overwrite your current everything.ini, without even asking. Backup your current INI if needed.
    • In the Options > Folder dialog you could configure a basic "scan C:\ every 10 hours", but also add to that a "scan c:\important_folder every 2 minutes". It won't appear twice in the index.
    • Be careful when to use EVERYTHING (the TCC internal command) and when to use EVERYTHING.EXE (the executable). At first I had setdos /i-everything and got crazy results
    • The install script has a preconfigured "scan C:\", without the excluded folders "c:\Windows\WinSXS" and "c:\windows\Softwaredistribution". Those are just examples. Tailor to your wishes.
    • Keep away from the General settings. Those require elevated right (minus the language option, I guess). Most of them can be converted to userspace, but I didn't see a point in that.
    • After installation, it will open the options screen (in the Folders dialog), so you can finetune Everything.
    • Don't forget to activate/check the Everything settings in TCC/TCMD through the OPTION command.
    • Build and tested on TCC 20.00.25 x64 Windows 7 [Version 6.1.7601]
     

    Attached Files:

    JohnQSmith likes this.

Share This Page