通过AutoHotkey的脚本
答
尝试:
Run, PowerShell "new-item -path c:\ -name logfiles -itemtype"
似乎为我工作。
编辑根据新提供的信息:
命令发现@http://exchangeserverpro.com/install-exchange-2013-pre-requisites-windows-server-2012/
尝试:
Run, PowerShell "Install-WindowsFeature AS-HTTP-Activation
, Desktop-Experience
, NET-Framework-45-Features
, RPC-over-HTTP-proxy
, RSAT-Clustering
, Web-Mgmt-Console
, WAS-Process-Model
, Web-Asp-Net45
, Web-Basic-Auth
, Web-Client-Auth
, Web-Digest-Auth
, Web-Dir-Browsing
, Web-Dyn-Compression
, Web-Http-Errors
, Web-Http-Logging
, Web-Http-Redirect
, Web-Http-Tracing
, Web-ISAPI-Ext
, Web-ISAPI-Filter
, Web-Lgcy-Mgmt-Console
, Web-Metabase
, Web-Mgmt-Console
, Web-Mgmt-Service
, Web-Net-Ext45
, Web-Request-Monitor
, Web-Server
, Web-Stat-Compression
, Web-Static-Content
, Web-Windows-Auth
, Web-WMI
, Windows-Identity-Foundation"
答
+0
@Chad ..我提供的命令只是一个例子。其实我想从下面的文章中运行'Add-Windowsfeature'命令:http://exchangeserverpro.com/install-exchange-2013-pre-requisites-windows-server-2012/我无法运行它,因为一个说VARIABLE NAME太长的错误。请建议。 – samisda1
答
如果你想运行从AHK PowerShell脚本,它包含几行,你不想要使用外部文件,这是一个例子,如何做到这一点:
的AutoHotkey代码:
psScript =
(
param($param1, $param2)
new-item -path $param1 -name logfiles -itemtype directory
new-item -path $param2 -name logfiles -itemtype directory
remove-item -path 'c:\temp'
# etc, write any code, use this quotes for strings: '
# if you need ", then write: \":
$import = '[DllImport(\"ntdll.dll\")] public static extern int RtlAdjustPrivilege(ulong a, bool b, bool c, ref bool d);'
)
param1 = C:\temp
param2 = D:\temp
RunWait PowerShell.exe -Command &{%psScript%} '%param1%' '%param2%',, hide
; use this call if you want to see powershell output
Run PowerShell.exe -NoExit -Command &{%psScript%} '%param1%' '%param2%'
你提供的那个也适用于我。但是,当我使用'Add-Windowsfeature'命令而不是该示例中的命令时,出现一个错误,指出VARIABLE NAME TOO LONG太长。任何建议请。 – samisda1
我编辑了包含Add-Windowsfeature代码的代码,但是如果它正在工作还没有报告回来? – errorseven
运行后出现同样的错误。你能想到的其他方式吗?非常感谢。 – samisda1