Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmd 有关runas命令的信息_Cmd_Runas_Icacls - Fatal编程技术网

Cmd 有关runas命令的信息

Cmd 有关runas命令的信息,cmd,runas,icacls,Cmd,Runas,Icacls,这个问题可能是重复的,但因为我没有找到任何答案,我把它贴在这里 我的用户名之间有空格;那么,在使用runas时,我应该如何编写它;我应该使用双引号还是单引号\ e、 g.runas/noprofile/user:mymachine pc\john smith cmd 在上面的例子中,约翰和史密斯之间有空格 我的命令包含路径、双引号等;所以,我应该如何将整个内容作为cmd传递给runas;例如 cmd=icacls“C:\Users\Public\Public Desktop”/GRANT Joh

这个问题可能是重复的,但因为我没有找到任何答案,我把它贴在这里

  • 我的用户名之间有空格;那么,在使用runas时,我应该如何编写它;我应该使用双引号还是单引号\

    e、 g.runas/noprofile/user:mymachine pc\john smith cmd

  • 在上面的例子中,约翰和史密斯之间有空格

  • 我的命令包含路径、双引号等;所以,我应该如何将整个内容作为cmd传递给runas;例如

    cmd=icacls“C:\Users\Public\Public Desktop”/GRANT John smith:F/T

  • 我想以同样的方式运行上面的命令

    "runas /noprofile /user:mymachine-pc\john smith icacls "C:\Users\Public\Public Desktop" /GRANT John smith:F /T
    

    现在上面的命令有很多问题;我真的很困惑;约翰·史密斯也有管理权;我正在尝试从批处理文件运行此命令

    尝试转义内部引号

    runas /noprofile /user:"mymachine-pc\john smith" "icacls \"C:\Users\Public\Public Desktop\" /GRANT \"John smith\":F /T"
    

    引号环绕整个字符串,因此
    runas/noprofile/user:“mymachine pc\john smith”cmd
    (除了您的名字之外,我没有检查任何东西)。Icacls需要冒号,因此您的命令不能使用引号或不使用引号
    runas/noprofile/user:“mymachine pc\john smith”icacls“C:\Users\Public\Public Desktop”/GRANT:“john smith”:F/T
    @谢谢您的帮助;我用过的建议请看下面的日志;虽然没有给出错误,但我的文件权限没有更改C:\Users\john smith>runas/noprofile/user:“johnsmith pc\john smith”“icacls\”C:\ProgramData\setti ngs\u config.bin\”/GRANT\“john smith\”:F/t“输入johnsmith pc的密码\john smith:尝试启动icacls”C:\ProgramData\settings\u config.bin“/GRANT”john smith”:F/T作为用户“约翰史密斯电脑\约翰史密斯”。。。文件权限未更改冒号读取我的注释我在授予后使用冒号:除此之外的任何其他方式都会出现错误…似乎runas用户之后的所有内容:“mymachine pc\john smith”应该介于双引号之间您是否正确复制了命令?我在你的评论中看到C:之间有一个空格。。。“icacls\”C:\ProgramData…
    C:\Users\David Candy>RunAs/user:administrator“icacls delstack.bat/grant\”David Candy\”:F“这是有效的”
    。在对象上键入icacls并粘贴到此处,让我们看看发生了什么。