"%tmp%\j.j" echo;s=WSH.StdIn.ReadLine().replace(/^^.+?\.(bat^|cmd)" /ig,''); ... - Discuz! Board" />
365 体育在线网址_365bet体育线上平台_谁有365体育在线网址新手入门导读[视频教程]365 体育在线网址_365bet体育线上平台_谁有365体育在线网址基础视频教程[视频教程]VBS基础视频教程
[365 体育在线网址_365bet体育线上平台_谁有365体育在线网址文件精品]365 体育在线网址_365bet体育线上平台_谁有365体育在线网址版照片整理器[365 体育在线网址_365bet体育线上平台_谁有365体育在线网址文件精品]纯365 体育在线网址_365bet体育线上平台_谁有365体育在线网址备份&还原驱动在线第三方下载
返回列表 发帖

20元求助:365 体育在线网址_365bet体育线上平台_谁有365体育在线网址改进方案给拖入文件夹挂上图标

  1. setlocal enabledelayedexpansion
  2. >"%tmp%\t.t" echo;!cmdcmdline!
  3. endlocal
  4. >"%tmp%\j.j" echo;s=WSH.StdIn.ReadLine().replace(/^^.+?\.(bat^|cmd)" /ig,'');
  5. >>"%tmp%\j.j" echo;WSH.echo(s.replace(/"/g,'').replace(/ (?=[a-z]:)/ig,'\r\n'));
  6. for /f "delims=" %%a in ('type "%tmp%\t.t"^|cscript -nologo -e:jscript "%tmp%\j.j"') do (
  7.     if exist "%%a\" (
  8.         del /f /q /ah "%%a\desktop.ini" 2>nul
  9.         set "f="
  10.         for /f "delims=" %%b in ('dir /a-d/b "%%a\*.ico" 2^>nul') do (
  11.             set f=1
  12.             (echo;[.ShellClassInfo]
  13.             echo;IconResource=%%b
  14.             echo;[ViewState]
  15.             echo;Mode=
  16.             echo;Vid=
  17.             echo;FolderType=Pictures)>"%%a\desktop.ini"
  18.             attrib +s +h "%%a\%%b"
  19.             attrib +s +h "%%a\desktop.ini"
  20.             attrib +r "%%a"
  21.         )
  22.         if not defined f (
  23.             for /f "delims=" %%c in ("%%a") do echo;找不到文件 - "%%~nxc"
  24.         )
  25.     )
  26. )
  27. :end
  28. echo;
  29. pause
  30. exit
复制代码
目的是一次性给所有拖入文件夹挂上图标(图标在文件夹内)
之前修改后可以处理特殊符号(如&)。现在又遇到问题了:文件名含有"・"会被传递成"?"
求解决

错误信息:
文件夹名:・・・
del /f /q /ah "C:\Users\sword\Desktop\???\desktop.ini"  2>nul
set "f="
for /F "delims=" %b in ('dir /a-d/b "C:\Users\sword\Desktop\???\*.ico" 2>nul') do (
set f=1

  1. if($PSVersionTable.PSVersion.Major -lt 3){'PS 版本太低,若运行不正常则先升级PS';cmd /c Pause}
  2. Write-Host '拖入文件夹 ' -fore Magenta -NoNewline; $folder = Read-Host;
  3. ls "$folder\*.ico" -rec -Force|%{iex ([Text.Encoding]::GetEncoding(1200).GetString([convert]::FromBase64String('JABpAGMAbwAgAD0AIAAnAFsALgBTAGgAZQBsAGwAQwBsAGEAcwBzAEkAbgBmAG8AXQAnACwAIgBJAGMAbwBuAFIAZQBzAG8AdQByAGMAZQA9ACQAKAAkAF8ALgBOAGEAbQBlACkAIgAsACcAWwBWAGkAZQB3AFMAdABhAHQAZQBdACcALAAnAE0AbwBkAGUAPQAnACwAJwBWAGkAZAA9ACcALAAnAEYAbwBsAGQAZQByAFQAeQBwAGUAPQBQAGkAYwB0AHUAcgBlAHMAJwA7AAoAIAAgACAAIABzAGMAIAAiACQAKAAkAF8ALgBEAGkAcgBlAGMAdABvAHIAeQBOAGEAbQBlACkAXABEAGUAcwBrAHQAbwBwAC4AaQBuAGkAIgAgAC0AVgBhAGwAdQBlACAAJABpAGMAbwAgAC0ARgBvAHIAYwBlADsACgAgACAAIAAgACgARwBlAHQALQBJAHQAZQBtACAAJABfAC4ARgB1AGwAbABOAGEAbQBlACAALQBGAG8AcgBjAGUAKQAuAEEAdAB0AHIAaQBiAHUAdABlAHMAIAA9ACcAaABpAGQAZABlAG4AJwAsACcAcwB5AHMAdABlAG0AJwAsACcAYQByAGMAaABpAHYAZQAnADsACgAgACAAIAAgACgARwBlAHQALQBJAHQAZQBtACAAIgAkACgAJABfAC4ARABpAHIAZQBjAHQAbwByAHkATgBhAG0AZQApAFwARABlAHMAawB0AG8AcAAuAGkAbgBpACIAIAAtAEYAbwByAGMAZQApAC4AQQB0AHQAcgBpAGIAdQB0AGUAcwAgAD0AJwBoAGkAZABkAGUAbgAnACwAJwBzAHkAcwB0AGUAbQAnACwAJwBhAHIAYwBoAGkAdgBlACcAOwAKACAAIAAgACAAKABHAGUAdAAtAEkAdABlAG0AIAAkAF8ALgBEAGkAcgBlAGMAdABvAHIAeQAgAC0ARgBvAHIAYwBlACkALgBBAHQAdAByAGkAYgB1AHQAZQBzACAAPQAnAHIAZQBhAGQAbwBuAGwAeQAnACwAJwBhAHIAYwBoAGkAdgBlACcAOwA=')))
  4. }
  5. $msg = [Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('UQBRACAANAA1ADgANgAwADkANQA4ADYAIAB8ACAArl/hTyAAeABjAHoAMwA2ADAANgA='));
  6. Write-Host "`n====== $msg ======`n" -fore Red;
  7. &cmd /c timeout -t 60
  8. &cmd /c pause`&exit
复制代码
QQ: 458609586

TOP

本帖最后由 flashercs 于 2019-11-7 03:41 编辑

365 体育在线网址_365bet体育线上平台_谁有365体育在线网址要保存为utf8-nobom编码,见附件。再者,Windows系统的desktop.ini编码都是Unicode-BOM,如果不正常,可能需要转码!
  1. <#*,:&cls
  2. @echo off
  3. >nul,chcp 65001
  4. REM 下面重定向到文件的编码都是utf8NoBom,注意,Windows默认desktop.ini编码是Unicode,如不正常,请转码desktop.ini
  5. for /f "delims=" %%a in ('echo,%cmdcmdline%^|Powershell -NoProfile -ExecutionPolicy RemoteSigned -Command ". ([ScriptBlock]::Create((Get-Content -LiteralPath \"%~0\" -ReadCount 0 -Encoding utf8| Out-String ))) "') do (
  6.   if exist "%%a\" (
  7.         del /f /q /ah "%%a\desktop.ini" 2>nul
  8.         set "f="
  9.         for /f "delims=" %%b in ('dir /a-d/b "%%a\*.ico" 2^>nul') do (
  10.             set f=1
  11.             (echo;[.ShellClassInfo]
  12.             echo;IconResource=%%b
  13.             echo;[ViewState]
  14.             echo;Mode=
  15.             echo;Vid=
  16.             echo;FolderType=Pictures)>"%%a\desktop.ini"
  17.             attrib +s +h "%%a\%%b"
  18.             attrib +s +h "%%a\desktop.ini"
  19.             attrib +r "%%a"
  20.         )
  21.         if not defined f (
  22.             for /f "delims=" %%c in ("%%a") do echo;找不到文件 - "%%~nxc"
  23.         )
  24.     )
  25. )
  26. >nul,chcp 936
  27. pause
  28. exit /b
  29. #>
  30. [console]::In.ReadToEnd() -replace '^.+?(cmd|bat)" |"','' -replace ' (?=[a-z]:)',"`r`n"
复制代码
附件: 您需要登录才可以下载或查看附件。没有帐号?注册
Email:guangchengwang@163.com
QQ:49908356

TOP

返回列表