[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 ivor 于 2019-11-11 16:55 编辑
  1. function err {
  2.     param (
  3.         [string]$file
  4.     )
  5.     "找不到文件 - {0}" -f $file
  6. }
  7. foreach ($arg in $args) {
  8.     if (![System.IO.File]::Exists($arg.ToString()+"\*.ico")) {
  9.         err(([System.IO.FileInfo]$arg.ToString()).Name)
  10.         continue
  11.     }
  12.     Remove-Item $arg+"\desktop.ini" -Force
  13.     $dir = $arg
  14.     Push-Location $arg
  15.     foreach ($item in (Get-ChildItem -File *.ico)) {
  16.         $icon = $item.Name
  17.     }
  18.     '[.ShellClassInfo]
  19.         IconResource={0}
  20.         [ViewState]
  21.         Mode=
  22.         Vid=
  23.         FolderType=Pictures
  24.     ' -f $icon | Out-File -FilePath $dir+"\desktop.ini"
  25.     attrib +s +h $dir+"\desktop.ini"
  26.     attrib +s +h "%icon%"
  27.     attrib +r /d $dir
  28.     Pop-Location
  29. }
复制代码
#&cls&@powershell "Invoke-Expression ([Io.File]::ReadAllText('%~0',[Text.Encoding]::UTF8))" &pause&exit

TOP

返回列表