Giter VIP home page Giter VIP logo

Comments (4)

mklement0 avatar mklement0 commented on August 28, 2024

That's all very mysterious; clip.exe should be in C:\Windows\system32\clip.exe, and C:\Windows\system32 should always be in $env:PATH.

What does (Get-Command clip.exe).Source report?

Are there malformed entries in $env:PATH?

What does nowadays mean? Did you upgrade to a new PS Core version, and what is that version?

from clipboardtext.

iricigor avatar iricigor commented on August 28, 2024

I cannot reproduce on my pwsh with latest Windows 10. Ad PATH check, @greenmooseSE can you also compare cmd path with PSCore path? It should be the same, but you never know. What the command "$(cmd.exe /c PATH)" -eq "PATH=$($env:PATH)" gives you in PS Core?

However, I did this test and it shows unexpected behaviour.

I copied clip.exe from system32 to my current location, i.e. c:\temp. Then inside of that folder, I executed cmd.exe /c clip.exe /? and I got nothing for the output.

Regardless of the root cause of a problem, @mklement0 can solution be to use full path instead of clip.exe here?

from clipboardtext.

greenmooseSE avatar greenmooseSE commented on August 28, 2024

Investigated a bit more and my issue seems to be when invoking cmd.exe from a pwsh.exe shell the %PATH% variable get corrupted (for whatever reason it seems to be too long) so my standard items that should be part of PATH are not working either.

When I am invoking cmd.exe via Start->Run, or from a "standard powershell" shell, it works as expected and the length of %PATH% value is a lot smaller.

Difference in size when doing echo %PATH% >file.txt:
image

(So far I have not had any issues with this other than when using ClipboardText, I have modified it locally though with above change to get it working for me)

from clipboardtext.

mklement0 avatar mklement0 commented on August 28, 2024

Thanks, guys.

Even though the problem turned out to be external to this module, I've decided to follow @iricigor's suggestions and use full paths for the execution of the external shells and clipboard programs (where known) in the just-published https://www.powershellgallery.com/packages/ClipboardText/0.1.8

Using full paths for executables in known locations is preferable from a security and predictability standpoint.

However, @iricigor, I'm mystified by your clip.exe-in-c:\temp example - did you find the cause?

from clipboardtext.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.