ParamStr、ParamCount、CmdLine-熊猫烧香代码学习之一

http://community.csdn.net/Expert/TopicView3.asp?id=5320418

Returns a specified parameter from the command-line.
返回当前命令行的详细参数信息
Unit

System

Category

command line utilities

Delphi syntax:

function ParamStr(Index: Integer): string;

C++ syntax:

extern PACKAGE AnsiString __fastcall ParamStr(int Index);

Description

ParamStr returns the parameter from the command line that corresponds to Index, or an empty string if Index is greater than ParamCount. For example, an Index value of 2 returns the second command-line parameter.

On Windows, ParamStr(0) returns the path and file name of the executing program (for example, C:\TEST\MYPROG.EXE).
On Linux, ParamStr(0) returns the command used to execute the program, without parameters (for example, ./myprogram). This behavior is dependent on information returned by the shell program and may not be consistent among all shells.
Note:    Use double quotes to wrap multiple words as one parameter (such as long file names containing spaces).

ParamStr(0) 在windows下返回应用程序路径和文件名称(含扩展名),参数则从1开始,
“function ParamCount: Integer; ”则返回存在的参数数量

另:
Delphi syntax:

var CmdLine: PChar platform;

下次再学。。。

posted @ 2007-01-30 09:27  云水浮萍  阅读(986)  评论(0编辑  收藏  举报