简体   繁体   English

为什么从Windows启动但不在命令提示符下运行程序?

[英]Why would a program run when launch from windows but not the command prompt?

I wrote a small C++ program in VS2k8. 我在VS2k8中编写了一个小型C ++程序。 When I launch it from windows (double click the exe file) it runs fine. 当我从Windows启动它(双击exe文件)时,它运行良好。 When I go to the command prompt and try to run it it will hang and eventually crash. 当我转到命令提示符并尝试运行它时,它将挂起并最终崩溃。 I've created test programs with simple outputs that work fine both ways. 我创建了具有简单输出的测试程序,这些输出在两种情况下均能正常工作。

Is there something I'm missing? 有什么我想念的吗? I'm relatively new to programming. 我是编程新手。 I'm trying to launch this program using the VBA shell command but it produces the same outcome as the command prompt. 我正在尝试使用VBA shell命令启动该程序,但其产生的结果与命令提示符相同。

The funny thing is it was working fine at first until I went in to change the value of a constant variable and rebuilt it (I didn't think that had anything to do with it but I changed it back with no success). 有趣的是,在我开始更改常量变量的值并重建它之前,它一直运行良好(我认为这与它没有任何关系,但是我改回了没有成功)。 No settings where changed. 没有更改的设置。

Edit: I've name it time.exe and than copies.exe (when I tried copying and pasting the code into a new project). 编辑:我将其命名为time.exe,而不是copys.exe(当我尝试将代码复制并粘贴到新项目中时)。 The actual code is about 250 lines, not sure what part of it would be causing the issue. 实际的代码大约为250行,不确定其中的哪一部分会引起问题。 It opens a .csv file, loads the information into vectors, and then compares the vectors to each other (adding something to the end of it if it meets certain conditions). 它打开一个.csv文件,将信息加载到向量中,然后将向量彼此进行比较(如果满足某些条件,则在其末尾添加一些内容)。 It than outputs the file to another .csv file. 然后将文件输出到另一个.csv文件。

可能建议启动时的当前目录不同,这在您对当前路径或驱动器做出一些假设时引起了您的问题?

暂无
暂无

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

相关问题 为什么Windows命令提示符说“更多? “当我运行一个带有d ^参数的程序时? - Why does the Windows command prompt say “More? ” when I run a program with an argument of d^? 为什么当在多个文件中通过命令提示符运行该C ++程序时会崩溃,而在单个文件上运行时却不会崩溃? - Why this C++ program crashes specifically when run through command prompt on multiple files but not when run on individual files? 如何从 C++ 程序运行命令提示符 - How to run Command Prompt from a C++ program 如何在Windows 7的命令提示符下编译和运行opencv代码 - how to compile and run opencv code from command prompt in windows 7 如何通过在资源管理器中以管理员身份启动的方式运行cpp中的程序? - How do I run a program from cpp the same way as I would do it via launch as admin in explorer? 在命令提示符下运行 C++ - Windows - Run C++ in command prompt - Windows 为什么项目在NetBeans内部终端中比在Windows命令提示符下“运行”更快? - Why does a project “run” faster in NetBeans internal terminal than in windows command prompt? 如何在Windows10的命令提示符下为opencv 3.0 c ++程序生成.exe? - How to generate .exe for opencv 3.0 c++ program from command prompt in windows10? 从命令提示符执行C ++程序 - Execute C++ program from command prompt Windows 10 命令提示符的输出不正确 - Incorrect output from windows 10 command prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM