subinacl 获得完整输出 [英] subinacl get full output

查看:32
本文介绍了subinacl 获得完整输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 Windows 控制台程序 subinacl.exe 授予用户停止和启动服务的权利.因此我们使用以下命令:

We are using the windows console program subinacl.exe to grant a user the right to stop and start a service. Therfore we use the following command:

subinacl.exe /service %SERVICE_NAME% /grant=%PC_NAME%\%USER_NAME%=PTO

哪里

  • %SERVICE_NAME% = 服务名称
  • %PC_NAME% = 计算机名称
  • %USER_NAME% = 有权启动和停止服务的用户名
  • PTO = 启动和停止服务的权利(R 只是读取)
  • %SERVICE_NAME% = name of the service
  • %PC_NAME% = name of the computer
  • %USER_NAME% = name of the user that should become the right to start and stop the service
  • PTO = right to start and stop the service (R would be just reading)

在 windows server 2012 上的默认 windows 命令行(具有管理员权限)中键入命令时,结果是:

When typing the command into the default windows command line (with administrator rights) on a windows server 2012 the result is:

ELITE_INETRSVSERVER : delete Perm. ACE 4 test-pc\test
ELITE_INETRSVSERVER : new ace for test-pc\test
ELITE_INETRSVSERVER : 2 change(s)


Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : ELITE_INETRSVSERVER

现在我们想将文本保存到文件中或将其放入程序中(通过重定向输出:从 shell/dos 应用程序获取输出到 Delphi 应用程序).我们需要在结果中找到 Done 和 Failed 的整数值.

Now we want to save the text into a file or get it into a programm (via redirect the outputs : Getting output from a shell/dos app into a Delphi app). We need the integer values of Done and Failed found in the result.

问题是,我们无法捕捉空行之后的最后三行.

The problem is, that we cannot catch the last three lines after the empty lines.

使用控制台重定向时,前三行可以在文件 result.txt 中找到.但最后三个显示在控制台中.

When using console redirect, the first three lines can be found in the file result.txt. But the last three are shown in the console.

subinacl.exe /service %SERVICE_NAME% /grant=%PC_NAME%\%USER_NAME%=PTO > result.txt 1<&2

以编程方式重定向输出时,我们确实遇到了同样的问题.

The same problem we do have, when redirecting the output programmatically.

当然每个命令都是以管理员身份执行的.

Of course every command is executed as administrator.

推荐答案

选项/errorlog 可以帮助解决问题:

The option /errorlog could help to solve the problem:

subinacl /outputlog=c:\NONERRORS.TXT /errorlog=C:\ERRORLOG.TXT /file C:\TEST.TXT /display

如果 C:\ERRORLOG.TXT 文件为空,则表示该命令已成功执行.

if C:\ERRORLOG.TXT file is empty it means that the command has been executed successfully.

这篇关于subinacl 获得完整输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆