W4RH4WK / Debloat-Windows-10

A Collection of Scripts Which Disable / Remove Windows 10 Features and Apps
Other
6.05k stars 846 forks source link

Run inside PowerShell #185

Closed jonvickers closed 5 years ago

jonvickers commented 5 years ago

I am new to Powershell. How do you call this script if you are already inside of a larger powershell script.

I have tried many options such as:

.\Win10.ps1 -include XXX -preset default.preset

I cannot figure out how to invoke from inside another powershell

W4RH4WK commented 5 years ago

PowerShell's syntax is a bit strange, and I don't understand fully myself. There is the & operator which can be used to execute things.

Of course you need to specify the path to the script you want to run. Relative path start at your current working directory. However, you may want to use absolute paths, depending on your setup.

Say, you just cloned this repository to your desktop. You can now use the following line to execute one of the scripts:

& $ENV:USERPROFILE\Desktop\Debloat-Windows-10\scripts\fix-privacy-settings.ps1

This should also work when used inside a script.