flyzy博客
分享便宜VPS与网络优惠
搬瓦工

求懂代码的大佬帮看一段代码

[url=home.php?mod=space&uid=20206]@echo[/url] off setlocal EnableDelayedExpansion for /f “delims=” %%i in (‘dir /x /b  *.?tf’) do ( set “zt=%%~si” mshta “javascript:new ActiveXObject(‘Shell.Application’).NameSpace(20).CopyHere(‘!zt:\=\\!’,0x0010);close()” ) echo. echo 字体安装完毕! pause >nul复制代码
这是一个windows下自动安装字体批处理,但是如果字体已存在会提示是否覆盖,问题就是在于这个覆盖,要怎么改这段代码可以自动确认覆盖不提示

青海省网友说:/Y复制代码

青海省网友说:试过不行,不知道是不是我添加的位置错了

青海省网友说:PowerShell

https://gist.github.com/anthonyeden/0088b07de8951403a643a8485af2709b
# Run this as a Computer Startup script to allow installing fonts from C:\InstallFont\ # Based on http://www.edugeek.net/forums/windows-7/123187-installation-fonts-without-admin-rights-2.html # Run this as a Computer Startup Script in Group Policy # Full details on my website – https://mediarealm.com.au/articles/windows-font-install-no-password-powershell/ $SourceDir   = “C:\InstallFont” $Source      = “C:\InstallFont\*” $Destination = (New-Object -ComObject Shell.Application).Namespace(0x14) $TempFolder  = “C:\Windows\Temp\Fonts” # Create the source directory if it doesn’t already exist New-Item -ItemType Directory -Force -Path $SourceDir New-Item $TempFolder -Type Directory -Force | Out-Null Get-ChildItem -Path $Source -Include ‘*.ttf’,’*.ttc’,’*.otf’ -Recurse | ForEach {     If (-not(Test-Path “C:\Windows\Fonts\$($_.Name)”)) {         $Font = “$TempFolder\$($_.Name)”                  # Copy font to local temporary folder         Copy-Item $($_.FullName) -Destination $TempFolder                  # Install font         $Destination.CopyHere($Font,0x10)         # Delete temporary copy of font         Remove-Item $Font -Force     } }复制代码

The option flag value 16 tells CopyHere to respond “Yes to All” for any questions.

赞(0) 打赏
关注我们
未经允许不得转载:flyzy博客 » 求懂代码的大佬帮看一段代码
分享到: 更多 (0)

这是一种鼓励

支付宝扫一扫打赏

微信扫一扫打赏