小编Ali*_*mdi的帖子

使用PowerShell静默自动运行cleanmgr.exe

我一直在研究一个脚本,该脚本应该在磁盘C:小于1gb时以静默方式运行cleanmgr.exe,它们都运行良好,但是我无法实现的一件事...

我想完全无声地运行cleanmgr.exe!我不想从磁盘清理GUI中看到任何内容,甚至看不到完成的屏幕。

使用sageset和sagerun使它自动化,但是它仍然显示该过程。

这是我的代码(我知道它在几件事上有一些问题,但是我专注于此处的静默执行,谢谢!):

if ($freeSpace -le $lowSpace)
{   
   cleanmgr.exe /sagerun:10
   defrag C:
}

else
{
   echo "sorry!"
   pause
}
Run Code Online (Sandbox Code Playgroud)

powershell disk

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

disk ×1

powershell ×1