Getting errors when running shell explorer Share command RRS feed

  • Question

  • Hello everyone, I am trying to integrate some windows features into my node application. I am getting an error however. My code is as follows:

    $shell = new-object -com "Shell.Application";

    $folder = $shell.Namespace("C:\\Users\\igweo");

    $item = $folder.Parsename("NailsMAIN.jpg");

    $verb = $item.Verbs() | ? {$_.Name -eq 'Share'};

    if ($verb) { $verb.DoIt(); };

    But I get the following error:

    STDERR:Invalid window handle. (Exception from HRESULT: 0x80070578)

    STDERR:At line:1 char:14
    + if ($verb) { $verb.DoIt(); };
    + ~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

    I want a pop up similar to like the one where you right click and click share on an image in windows 10. Also, is it possible to make sure the spawned powershell process closes after the popup window is closed as well?

    Not sure what to do as I have been trying to fix this one problem for over a week. Every other command works OK.

    Please help.
    Monday, May 20, 2019 5:12 PM


  • "Share" is not a verb that is available from the shell.  It can only be called from Explorer UI.


    • Marked as answer by daibatzu Sunday, May 26, 2019 5:14 PM
    Monday, May 20, 2019 6:22 PM

All replies