我创建了一个小的 PowerShell 脚本来删除 Autodesk 应用程序。但是,PowerShell 并不喜欢像 %username% 这样的系统变量。在 Powershell 中实现这一目标的最佳方法是什么?
# Remove all Autodesk products from a Windows System
$AutoDeskPaths = "C:\Users\%username%\AppData\Roaming\Autodesk", "C:\Users\%username%\AppData\Local\Autodesk", "C:\ProgramData\Autodesk", "C:\Program Files\Autodesk\AutoCAD 2012", "C:\Program Files\AutoCAD 2010", "C:\Program Files\Common Files\Autodesk Shared","HKCU:Software\Autodesk", "HKLU:Software\Autodesk"
Remove-item $AutoDeskPaths -Recurse