简体   繁体   中英

How do I store the real name of my application in powershell

I am new to Powershell and I want to write a script to remove a windows 8 application. The name of my file changes everytime but usually has 'wardobs' in it. So I use this line of code to find the application. get-appxpackage –Name *wardobs* I then copy the package family name, paste it into this line of code Remove-AppxPackage package family name and it removes my app. Rather than me having to paste the package family name into my code, how can I find the app that contains 'wardobs' in its name. Store the package family name in a variable and use that variable in my final line of code to remove the app?

# Get all packages, where name of the package matches *wardobs*
$Appx = Get-AppxPackage –Name *wardobs*

# Your code here

# Remove all packages stored in the $Appx variable
$Appx | Remove-AppxPackage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM