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

Special context menu entry - Howto?

Discussion in 'Operating Systems' started by 386SX, Jun 8, 2019.

  1. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,872
    Likes Received:
    4,509
    GPU:
    GeForce GTX 1070
    Yes. In cmd-file text you can combine like this "%~d1%~p1%~nx1" and that should be the same path (string) as "%1" (in case first parameter for cmd-file was a path to some file or folder).

    PS And most probably different parts can be combined like this: "%~dp1", "%~pnx1", "%~dpnx" - which is the same as just "%1" but probably is still correct.

    Yes.

    PS The cmd-file for a copy to storage context menu can be enhanced in the field of error handling. Current version just ignores errors possible in copy operation, but instead errors can be displayed to the user.
     
    Last edited: Jun 10, 2019
  2. 386SX

    386SX Master Guru

    Messages:
    451
    Likes Received:
    467
    GPU:
    AMD Vega64 RedDevil
    Sorry for the late reply on this @mbk1969 , I confess, I overread it ...

    For one single download with one connection some HDD may be sufficient if it is capable of continously writing ~50MB/s, but when multiple connections (and therefore mutiple write commands in parallel) are created, you see the download meter going up and down because neither the file buffer in Windows nor the HDD's buffer nor its speed in general are sufficient to continously download at this speed.

    At gbit speeds even older SSDs seem to have problems. Imagine 400 connections which continously write about 120MB/s to disk.

    Regarding your scripting tips:
    They work!
    Only one downside: I thought about clicking anywhere in the folder window where I am currently at, but I have to go up one level and then click on the folder itself, which I want to open.
    But anyway, here's the code for anyone who's interested:

    Create a file with extension *.REG and put this in:
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Folder\shell\openstorage]
    @="Open storage"
    
    [HKEY_CLASSES_ROOT\Folder\shell\openstorage\command]
    @="D:\\scripts\\openstorage.cmd \"%1\""
    
    Notes:
    (1) You may change the phrase between ">>...<<", remove the >><< afterwards. It will be the name for the option listed in the context menu later.
    (2) You may change the location of the script which should run as you like. Remember to use "\\" instead of "\" when writing a path, so C:\\folder\\filename.cmd instead of C:\folder\filename.cmd !!

    Create a file with extension *.CMD. Remember you the name of the CMD file has to match your entry in the REG file!

    Code:
    @explorer.exe /e,/root,"Z:\storage\%~nx1"
    
    Instead of Z:\storage\ use your own path. Remember this is batch script, so DO NOT use "\\" instead of "\"!! Use only "\" !!

    After creating both files put the CMD in the folder you set in the REG, then run the REG and reboot afterwards.
    A new command option will pop up if an item is selected, with the name you put in the REG file. Click it and a new Explorer window will pop up with the path you set.

    Thank you to @mbk1969 for his experience and help in this matter!

    P.S.: For better management I put my scripts into one folder in D:\scripts\*.* ... you may change the path as you like OR put the CMD somewhere in the reach of PATH (C:\Windows or C:\Windows\system32 for example) and run it without need to set a path (no "C:\folder\filename.cmd" needed, just "filename.cmd").
     
  3. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,872
    Likes Received:
    4,509
    GPU:
    GeForce GTX 1070
    Anywhere on empty space in the folder window should be the same as on the folder name itself one level up.

    Update: I just checked, and looks like MS changed that shell behaviour.
     
    Last edited: Jun 23, 2019
    386SX likes this.
  4. 386SX

    386SX Master Guru

    Messages:
    451
    Likes Received:
    467
    GPU:
    AMD Vega64 RedDevil
    You know any solution? Otherwise I google it myself. But you know the MS KB ... a "PITA" like you would say. ;-)

    EDIT:
    Code:
    Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\
    Seems to be this one, let's see if this works...
     
    Last edited: Jun 23, 2019

  5. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,872
    Likes Received:
    4,509
    GPU:
    GeForce GTX 1070
    Solution is to implement your own context menu handler (a real one, not some cmd-file).
     
    386SX likes this.
  6. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,872
    Likes Received:
    4,509
    GPU:
    GeForce GTX 1070
    I see at least one of shell menu from that registry key in Explorer in File menu - Powershell => command => powershell.exe -noexit -command Set-Location -literalPath '%V'
    (and menu is Open => Open Windows PowerShell... very handy command)
     
    386SX likes this.
  7. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,872
    Likes Received:
    4,509
    GPU:
    GeForce GTX 1070
    Using the full path is always faster and less burden, of course.
     
    386SX likes this.
  8. Rootkalk

    Rootkalk New Member

    Messages:
    5
    Likes Received:
    0
    GPU:
    8GB
    Yeah,you are right.
     

Share This Page