farag2 / Sophia-Script-for-Windows

:zap: The most powerful PowerShell module on GitHub for fine-tuning Windows 10 & Windows 11
MIT License
7.65k stars 578 forks source link

Sophi Script is downloaded to $PWD when you download it from .ps1 script #482

Closed soredake closed 1 year ago

soredake commented 1 year ago

Prerequisites

Steps to reproduce

1) Create script.ps1 file with powershell .\sophi.ps1 content. 2) Create sophi.ps1 file with irm script.sophi.app -useb | iex content. 3) Run script.ps1 4) Sophi will be downloaded to $PWD instead of ~/Downloads.

Windows Version

Windows 11 Pro 22H2 22621.1555

Sophia Script version

6.4.4

farag2 commented 1 year ago

This is by design: https://github.com/farag2/Sophia-Script-for-Windows/blob/baf4159b1f282175c425de3734ef4d98a936ebfb/Download_Sophia.ps1#L34

Someone asked me and I check before downloading. Not OK for you?

soredake commented 1 year ago

It's a bit confusing that it downloads to $PWD if currently directory is not $HOME or $env:SystemRoot\System32, i've wondered why my script is not working, i called sudo ~\Downloads\Sophia*\Sophia.ps1 -Function <Function> in script but to my surprise sophi script was not in downloads (probably current was changed when installing packages from choco/winget).

farag2 commented 1 year ago

What if I add a new parametr to specifiy the output folder?

irm script.sophi.app -useb -Path D:\folder | iex
farag2 commented 1 year ago

Ah, I couldn't... From now script will always be downloaded to a downloads folder.

https://github.com/farag2/Sophia-Script-for-Windows/commit/f006e0300b2ae458e37ab3d65302b4a900d8c2d0