Skip to content

Cannot move files with sudo on Windows 11 during the installation process #554

@KamilZielinski

Description

@KamilZielinski

Environment

  • System: Win11 (sudo enabled)
  • Terminal: PowerShell (non-privileged)
  • PHP: 8.4.12 (installation directory: C:\Program Files\php-8.4.12-Win32-vs17-x64)
  • PIE: 1.3.10 (wrapped into a pie.bat script @php "%~dp0pie.phar" %* so I can call it from the terminal (Windows finds it in the system path), both pie and bat scripts are in the same directory as mentioned above)

Description

I tried to install xdebug on my Windows machine, but it failed on the step where sudo had to move some files. While mv works just fine on Windows, using it with sudo somehow doesn't (I'm not familiar with sudo on Windows)

Example

PS C:\Users\me\Downloads\testtt> sudo mv .\source\file.txt .\target\file.txt
Command not found
PS C:\Users\me\Downloads\testtt> mv .\source\file.txt .\target\file.txt
PS C:\Users\me\Downloads\testtt> cd .\target\
PS C:\Users\me\Downloads\testtt\target> ls


    Directory: C:\Users\me\Downloads\testtt\target


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        18.03.2026     18:52              0 file.txt

This was the exact error I saw when trying to install xdebug (Command not found).

Screenshots

Image

Workaround

What helped was running a PowerShell as an Administrator:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions