cmd中的命令有效,但是当我尝试使用Python时,它表示'不被识别为内部或外部命令'

时间:2016-01-29 16:01:08

标签: windows cmd python-3.5

running cmd with python

嗨,我已经上传了一张显示我问题的图片。每当我尝试发出命令' runpkr00'在cmd.exe中,程序运行良好,流畅。

runpkr00

但是,如果我尝试使用Python打开cmd并编写相同的代码,我会收到错误,因为它未被识别为内部或外部命令'

>>>import os
>>>os.system('cmd')
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

`C:\Python35>runpkr00`
'runpkr00' is not recognized as an internal or external command,
operable program or batch file.

我已经检查了ENVIRONMENT VARIABLESC:\Windows\System32,`%SYSTEMROOT%\ system32。

还有其他解决方案吗? 我正在运行Windows 8.1单语言64位。

PS。如果我尝试输入ipconfig而不是runpkr00,则两者都有效。

1 个答案:

答案 0 :(得分:0)

我说我的问题是,如果我只是在Windows中运行cmd,我可以运行.exe文件。但是如果我用Python运行cmd,它会在某处丢失。

我所做的是编辑我的path变量。 我写下了C:\Windows\SysWOW64' inside路径and also placed a copy of my file.exe inside the C:\ Windows \ SysWOW64`目录。 幸运的是,这让它运转了。谢谢你的帮助。