Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.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
Node.js 为什么子进程不支持查询会话_Node.js - Fatal编程技术网

Node.js 为什么子进程不支持查询会话

Node.js 为什么子进程不支持查询会话,node.js,Node.js,大家好,我在网上搜索了很多,也尝试了下面的方法,但都不起作用,我不知道为什么 const exec = require('child_process'); let p = exec.execSync("query session").toString(); 有人能告诉我为什么上面这行的“查询会话”不能正常工作,除了“任务列表”、“whoami”等等,一切都正常吗 错误抛出,如下所示: Error: Command failed: query session rp

大家好,我在网上搜索了很多,也尝试了下面的方法,但都不起作用,我不知道为什么

 const exec = require('child_process');
 let p = exec.execSync("query session").toString();
有人能告诉我为什么上面这行的“查询会话”不能正常工作,除了“任务列表”、“whoami”等等,一切都正常吗

错误抛出,如下所示:

   Error: Command failed:  query session rpa-agent1
     at checkExecSyncError (child_process.js:629:11)
     at Object.execSync (child_process.js:666:13)
     at TestScreen.execute (C:\Users\Public\production_rpa_agent\action- 
     paths\testscreen\index.js:39:21)
     at Object.<anonymous> (C:\Users\Public\production_rpa_agent\action-paths\testscreen\index.js:67:4)
     at Module._compile (internal/modules/cjs/loader.js:778:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
     at Module.load (internal/modules/cjs/loader.js:653:32)
     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
     at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
错误:命令失败:查询会话rpa-agent1
在checkExecSyncError(child_process.js:629:11)
在Object.execSync(child_process.js:666:13)
在TestScreen.execute(C:\Users\Public\production\u rpa\u agent\action-
路径\testscreen\index.js:39:21)
反对。(C:\Users\Public\production\u rpa\u agent\action path\testscreen\index.js:67:4)
at模块编译(内部/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js(internal/modules/cjs/loader.js:789:10)
at Module.load(内部/modules/cjs/loader.js:653:32)
在tryModuleLoad(内部/modules/cjs/loader.js:593:12)
at Function.Module._load(内部/modules/cjs/loader.js:585:3)
位于Function.Module.runMain(internal/modules/cjs/loader.js:831:12)

查询会话是用于获取rdp登录用户的窗口命令。

什么是
查询会话
?特定于Windows?还有,它到底是如何不起作用的?@tadman更新了我的问题,是的,它特定于Windows,如果我直接键入cmdI通常会从命令中分割参数,所以
“query”,“session”
,因为这可能是在字面上查找
“query session.exe”
。是的,我知道,这就是为什么我说您可能需要从命令本身分离参数。