简体   繁体   English

不是内部或外部命令、可运行的程序或批处理文件

[英]is not recognized as an internal or external command, operable program or batch file

I'm trying to call an external function from Python: the function is vboxmanage.exe and I'm accessing it via subprocess call.我正在尝试从 Python 调用外部函数:该函数是 vboxmanage.exe,我通过子进程调用访问它。 The problem is that call cannot find the vboxmanage.exe program, even though it is listed in the path variable.问题是调用找不到 vboxmanage.exe 程序,即使它列在路径变量中。 I have tried every possible combination, with path, without path, with listing the full director, without listing the director, but call never finds it: vboxmanage is not recognized as an internal or external command, operable program or batch file.我已经尝试了所有可能的组合,有路径,没有路径,列出完整导演,不列出导演,但调用从未找到它:vboxmanage 不被识别为内部或外部命令、可运行的程序或批处理文件。

Here my questions:这是我的问题:

  1. For what reason does call disregard my path variable while in the Windows 10 commend prompt the path variable works fine?出于什么原因调用忽略我的路径变量而在 Windows 10 推荐提示中路径变量工作正常? I'm using shell=True, so this shouldn't happen.我正在使用 shell=True,所以这不应该发生。
  2. Why is it not possible to specify a path of a program and have it executed like that from the command prompt (assuming it's not in path variable).为什么不能指定程序的路径并让它像从命令提示符那样执行(假设它不在路径变量中)。 This used to work under DOS a long time ago, but not in Windows 10. Ie when I type in the command prompt "c:\\Program Files....\\vboxmanage.exe" it won't find the program.很久以前它曾经在 DOS 下工作,但在 Windows 10 中却没有。即,当我输入命令提示符“c:\\Program Files....\\vboxmanage.exe”时,它找不到该程序。 I have to first go into the directory and the execute it.我必须首先进入目录并执行它。
  3. Is there a way to manually navigate into the directory via call command and then invoke a second call command to open vboxmanage.exe?有没有办法通过调用命令手动导航到目录,然后调用第二个调用命令来打开 vboxmanage.exe?
from subprocess import call
param="c:\\Program Files\Oracle\VirtualBox\\vboxmanage controlvm MacBook keyboardputscancode "+h
print (param)
call([param], shell=True)

Just go to these folder: C:\\Program Files\\Oracle\\VirtualBox and copy all the files there and then paste them in this folder: C:\\Users\\username\\VirtualBoxVMs\\Ubuntu64 which contains the .VDI files.只需转到以下文件夹: C:\\Program Files\\Oracle\\VirtualBox并复制那里的所有文件,然后将它们粘贴到此文件夹中: C:\\Users\\username\\VirtualBoxVMs\\Ubuntu64 ,其中包含 .VDI 文件。 Then open command prompt and navigate to this folder: C:\\Users\\Username\\VirtualBoxVMs\\Ubuntu64 and run your command from there and it will be recognize.然后打开命令提示符并导航到此文件夹: C:\\Users\\Username\\VirtualBoxVMs\\Ubuntu64并从那里运行您的命令,它将被识别。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 'pip3' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'pip3' is not recognized as an internal or external command, operable program or batch file 'pip'不被识别为内部或外部命令,可操作程序或批处理文件 - 'pip' is not recognized as an internal or external command, operable program or batch file '{'不被识别为内部或外部命令,可操作程序或批处理文件 - '{' is not recognized as an internal or external command, operable program or batch file '。' 不被识别为内部或外部命令、可运行程序或批处理文件。 什么是 '。'? - '.' is not recognized as an internal or external command, operable program or batch file. What is '.'? python 不被识别为内部或外部命令、可运行程序或批处理文件 - python is not recognized as an internal or external command, operable program or batch file 'lessc' 不是内部或外部命令,也不是可运行的程序 或批处理文件 - 'lessc' is not recognized as an internal or external command, operable program or batch file 'tee' 不是内部或外部命令、可运行程序或批处理文件 - 'tee' is not recognized as an internal or external command, operable program or batch file 'rasa' 不是内部或外部命令、可运行程序或批处理文件 - ‘rasa’ is not recognized as an internal or external command, operable program or batch file 'jupyter' 不是内部或外部命令、可运行程序或批处理文件 - 'jupyter' is not recognized as an internal or external command, operable program or batch file 'pyuic5' 不是内部或外部命令、可运行程序或批处理文件 - 'pyuic5' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM