本文介绍了runas不允许复杂的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个应用程序,我试图运行高架在Windows 7和Windows XP瘦客户端,但我似乎无法让runas.exe cmd行正确。我知道我需要反斜杠转义字符,所以runas正确地解释空格。发送runas一个已经用反斜杠转义的单个参数时,这样做起作用。这种情况是我发现的一个解决方案,它的工作原理,但是,我需要发送多个参数,所有参数都是用反斜杠转义,因为由于文件路径等原因造成的空格。这里有一些例子:



这些工作正如预期会提示管理员密码:



runas.exe / user:Administrator C:\update_andon.exe autosetup / kiosktype:\Andon Kiosk\



runas.exe / user:AdministratorC:\update_andon.exe autosetup / directory:\C:\Program Files\CIMS_Andon\Kiosk\



当我开始添加我需要的其余参数,如下面的行时,我收到runas帮助文本,指出有问题:



runas.exe / user:administratorC:\update_andon.exe autosetup / kiosktype:\Andon Kiosk\ /exename:\\"eAndonKiosk.exe\"\ / directory:\ C:\Program Files\CIMS_Andon\K iosk\ / repository:\\\domain\sat\shared\repository\andand kiosk\



一个解决方案是一次一个接一个地运行每个参数,但我不认为这是一个解决方案,因为它是一个解决方法。我错过了一些与反斜杠混合在一起的各种论据吗?我在哪里找不到更多的引用?



谢谢

解决方案

:将命令写入批处理脚本,并通过 runas 运行脚本。


I have an app that I'm trying to run elevated on windows 7 and windows xp thin clients but I cant seem to get the runas.exe cmd line correct. I know I need the backslash escape character in there so runas interprets the spaces correctly. This works when sending runas a single argument that has been escaped with a backslash. This scenario is all I found as a solution and it works however, I need to send multiple arguments that are all escaped with backslashes because of spaces in the arguements due to file paths, etc. Here are some examples:

These work And as expected will prompt for the administrator password:

runas.exe /user:Administrator "C:\update_andon.exe autosetup /kiosktype:\"Andon Kiosk"\

runas.exe /user:Administrator "C:\update_andon.exe autosetup /directory:\"C:\Program Files\CIMS_Andon\Kiosk"\

When I start adding the rest of the arguments I need such as the line below, I receive the runas help text indicating there was an issue:

runas.exe /user:administrator "C:\update_andon.exe autosetup /kiosktype:\"Andon Kiosk"\ /exename:\"eAndonKiosk.exe"\ /directory:\"C:\Program Files\CIMS_Andon\Kiosk"\ /repository:\"\\domain\sat\shared\repository\andon kiosk"\"

One solution is to run each argument at a time one after the other but I dont see this as a solution as much as it is a workaround. Am I missing something with the way I have the backslashes mixed in with the various arguments? Am I missing more quotes somewhere?

Thanks

解决方案

Canonical solution: write the command to a batch script and run the script via runas.

这篇关于runas不允许复杂的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 17:04