本帖最后由 ivor 于 2019-11-11 16:55 编辑
- function err {
- param (
- [string]$file
- )
- "找不到文件 - {0}" -f $file
- }
-
- foreach ($arg in $args) {
- if (![System.IO.File]::Exists($arg.ToString()+"\*.ico")) {
- err(([System.IO.FileInfo]$arg.ToString()).Name)
- continue
- }
- Remove-Item $arg+"\desktop.ini" -Force
- $dir = $arg
- Push-Location $arg
- foreach ($item in (Get-ChildItem -File *.ico)) {
- $icon = $item.Name
- }
- '[.ShellClassInfo]
- IconResource={0}
- [ViewState]
- Mode=
- Vid=
- FolderType=Pictures
- ' -f $icon | Out-File -FilePath $dir+"\desktop.ini"
- attrib +s +h $dir+"\desktop.ini"
- attrib +s +h "%icon%"
- attrib +r /d $dir
- Pop-Location
- }
复制代码
|