在用windows任务执行kettle的kjb或ktr文件时,可通过bat命令传递参数,测试了很久,特此记录一下。
一、pan\kitchen 参数说明
Options:
/rep : Repository name
/user : Repository username
/pass : Repository password
/job : The name of the job to launch
/dir : The directory (dont forget the leading /)
/file : The filename (Job XML) to launch
/level : The logging level (Basic, Detailed, Debug, Rowlevel, Error, Nothing)
/logfile : The logging file to write to
/listdir : List the directories in the repository
/listjobs : List the jobs in the specified directory
/listrep : List the available repositories
/norep : Do not log into the repository
/version : show the version, revision and build date
/param : Set a named parameter <NAME>=<VALUE>. For example -param:FOO=bar
/listparam : List information concerning the defined parameters in the specified job.
/export : Exports all linked resources of the specified job. The argument is the name of a ZIP
二、常规变量的书写格式
options 后面可以是=也可以是:也可以是空格
如:pan /file d:\test.ktr 或者 -file=D:\test.ktr
三、参数变量的特殊格式
window下,一定要用 " " 双引号,多个变量按顺序书写即可(linux下不用引号)
如:pan /file d:\test.ktr "-param:key1=value1" "-param:key2=value2"
四、kjb\ktr参数变量的接收
一定在任务中定义命名参数,否则参数无法传递成功