批处理文件直接运行,但不在启动中运行


0

直接运行时,以下批处理代码可以正常工作(打开“首选项”窗口,将Windows 7主题设置为背景,然后关闭“首选项”窗口),但在启动文件夹中启动时,它会创建两个“首选项”窗口的实例(其中一个表示无法加载)并且不删除任何一个实例)。试过变化,但没有达到预期的结果。

control /name Microsoft.Personalization
start C:\Windows\Resources\Themes\aero.theme
timeout 2

set temp_vbs="%TEMP%\%~nx0.tmp0.vbs"
(
    echo Dim objShell
    echo Set objShell = CreateObject("WScript.Shell"^)
    echo If objShell.AppActivate("Personalization"^) = True Then
    echo    objShell.SendKeys("%%{F4}"^)
    echo End If
) > %temp_vbs%
cscript %temp_vbs% /

del %temp_vbs%

是否需要提升才能正确运行?
Twisty Impersonator

在那种情况下它甚至可以运行吗?
NL42

此代码更改消除了第二个首选项窗口,但不删除显示的窗口。
NL42

echo off control / name Microsoft.Personalization timeout 2 set temp_vbs =“%TEMP%\%~nx0.tmp0.vbs”启动c:\ windows \ resources \ themes \ aero.theme(echo Dim objShell echo set objShell = CreateObject(“ WScript.Shell“^)echo如果objShell.AppActivate(”Personalization“^)= True则回显objShell.SendKeys(”%% {F4}“^)echo End If)> %temp_vbs%cscript%temp_vbs%/ del%temp_vbs%taskkill / f“WindowTitle eq Personalization”
NL42

我复制了代码,它消除了换行符。
NL42
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.