需要从命令行运行 Windows 安全对话框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/398571/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Need to Run Windows Security Dialog Box from Command Line
提问by jeffspost
You know, what you normally get when typing ctrl-alt-del or ctrl-alt-end. Except in this scenario I can't press those keys, but I want to launch that box. Specifically I want to be able to pull up the change password dialog from the command line.
您知道,您通常在键入 ctrl-alt-del 或 ctrl-alt-end 时会得到什么。除了在这种情况下,我无法按下这些键,但我想启动那个盒子。具体来说,我希望能够从命令行拉出更改密码对话框。
Thanks
谢谢
回答by Raymond Chen
You call the Shell.WindowsSecurity
method. The documentationincludes sample code.
你调用Shell.WindowsSecurity
方法。该文档包括示例代码。
回答by Ben Key
Here is an extension of the answer given by Raymond Chen. I shows how to call the WindowsSecurity from a batch file. Note that it will only work properly when connected by a terminal session to Microsoft Terminal Server.
这是Raymond Chen给出的答案的扩展。我展示了如何从批处理文件中调用 WindowsSecurity。请注意,它只有在通过终端会话连接到 Microsoft 终端服务器时才能正常工作。
@if (@CodeSection == @Batch) @then
@echo off
:: See https://gist.github.com/DavidRuhmann/5199433 and
:: http://msdn.microsoft.com/en-us/library/windows/desktop/gg537748%28v=vs.85%29.aspx
:: for details.
CScript //E:JScript //Nologo "%~0" %*
exit /b
@end
try
{
var objShell = new ActiveXObject("shell.application");
objShell.WindowsSecurity();
WScript.Quit(0);
}
catch(e)
{
WScript.Quit(1);
}
回答by Greg
OSK.exe will bring up an on screen keyboard. It should allow you to hit ctrl-alt-del
OSK.exe 将调出屏幕键盘。它应该允许您按 ctrl-alt-del
回答by Eric H
control.exe password.cpl- will launch the password Control Panel applet.
control.exe password.cpl- 将启动密码控制面板小程序。