windows-7 - VS调试C++工程时__wargv的值和双击运行exe程序时的值不一样?
ringa_lee
ringa_lee 2017-04-17 13:58:11
0
2
559

经过查阅资料,C++中的__wargv值是命令行参数。
VS中设置命令行参数的方法是,项目——属性——配置属性——调试——命令参数,设置命令参数就可以传入。
VS调试时,__wargv值为设置的参数。而双击运行该程序的exe文件时,__wargv值却只是exe文件的路径,并没有我在VS项目中设置的值。
请问,双击运行exe是不会传入命令行参数吗,VS生成exe文件的同时不会生成命令行参数设置的相关文件?
经搜索引擎搜索,没有查找到双击运行exe和VS调试时命令行参数的区别。各位大神如有相关资料,望告知。跪谢。

ringa_lee
ringa_lee

ringa_lee

reply all(2)
伊谢尔伦

If you need to pass in parameters when running your exe program, you cannot double-click to run it. Instead, you should specify the parameters in the cmd console.
For example, if your program is called test.exe and you need to pass in the parameter "-c", then you can enter the path of test.exe in cmd and enter the command
test.exe -c and press Enter to bring the parameters. Run your program

黄舟

When double-clicking to run vs is not in debugging state, of course there will be no parameters.
The correct way is to create a shortcut and write

in the target
xxx.exe -param1 param2 /param3
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template