stax76 / OpenWithPlusPlus

Open with++ context menu shell extension
MIT License
347 stars 15 forks source link

[Square brackets] in (any) parent folder cause wrong Working Directory(if unspecified) #31

Open Hlsgs opened 1 year ago

Hlsgs commented 1 year ago

If the parent folder of the file one is trying to run a script on contains square brackets(there might be other problematic characters, but this is the situation I've stumbled upon) and Working Directory is unspecified, the execution ends up in C:\Windows\System32\WindowsPowerShell\v1.0. You probably just need the equivalent of Powershell's -LiteralPath somewhere in your .NET code :)

Settings item for easy replication:

    <Item>
      <AllFiles>false</AllFiles>
      <Arguments>-NoExit -ExecutionPolicy RemoteSigned -file "%OpenWithPPDir%\test.ps1" %paths%</Arguments>
      <Directories>false</Directories>
      <FileTypes>*.*</FileTypes>
      <FileTypesDisplay>*.*</FileTypesDisplay>
      <Filter />
      <Hidden>false</Hidden>
      <HideWindow>false</HideWindow>
      <IconFile />
      <IconIndex>0</IconIndex>
      <Name>TEST</Name>
      <Path>powershell.exe</Path>
      <RunAsAdmin>false</RunAsAdmin>
      <SubMenu>false</SubMenu>
      <WorkingDirectory />
    </Item>

%OpenWithPPDir%\test.ps1:

get-location

I would like to take this opportunity to thank you for this excellent piece of software. I've only recently found it and it's insanely useful. Here's hoping you have the time and disposition to keep maintaining it. I also wholehartedly agree with https://github.com/stax76/OpenWithPlusPlus/issues/24#issuecomment-1150668803. I wouldn't bother with W11's new context menu. Let's just hope MS doesn't decide to stop supporting the "old" one.

If I could add a "personal" request, a dark mode for the settings window would be great. I presume/hope that .NET facilitates that pretty easily. This might sound like a fad, but for some of us with specific eyesight issues it's not just a preference but rather a must.

Thank you!

EDIT While creating the above settings it dawned on me: A checkbox to disable each entry would be very useful.