企業管理 > Windchill 匯出與匯入 > 《PTC Windchill PLM Connector - Creo Packages 管理員及使用者指南》 > Creo Packages > Importing Packages > Importing a Package > Using the Command Line Utility
  
Using the Command Line Utility
The command line utility administers Creo Packages commands and arguments for creating packages of Creo Parametric files to be shared from a source PLM system to one or more target PLM systems where Creo Parametric and Creo Packages are installed.
The command line utility is implemented as a combination of argument and variables. It can be used for automatic import scenarios where a script contains one or more command line arguments, or to perform a specific action at the command line, typically by a Creo Parametric user.
The following table contains essential commands for the command line utility:
Command Name
Description
WPCImport
Initiates the import of a package that accepts arguments and values.
WPCView
Initiates package viewer and takes one package name as input.
WPCDelete
Deletes the temporary Creo Packages workspaces that remain in Windchill, if WPCExport fails.
WPCProEShutdown
Disconnects the Creo Parametric session.
Rules
The following rules govern command line entries in Creo Packages:
The command line is case sensitive, except when specifying a location.
If a string contains a space or any special characters (for example, commas), enclose the string in quotation marks. For example, if the folder name is test folder, then it is presented as:
“test folder”
All directory paths can be either absolute or relative.
If multiple values are allowed, use a comma (,) to separate them.
* 
Some objects, such as the Windchill baseline, allow a comma in a name. In this instance, use the backslash escape character (\) to distinguish the comma from the multivalue separator.
The prefixes used in the wpc_preferences.txt file are the following:
%o—Indicates what operation is being performed. Values can be export or import.
%u—The username for Creo Packages.
The directory separator is platform-specific. On Windows the indicator is two slashes (\\) when specifying the paths for a recipe file location or a command line argument location. You can also use the syntax ${dir.sep} as a directory separator. When ${dir.sep} is used in wpc_preferences.txt, $ is replaced with \\. The \\ and the ${dir.sep}separators can be used in combination. For example:
#export.default.recipefile=c:\\ptc\\wpc${dir.sep}recipes\
\defaultRecipeFile.rcp
Conflict resolution is specified as the following:
conflict.<ConflictType>=<ResolutionType>
There can be multiple resolution type values. The conflict type can have keywords assigned.
In this example, OVERRIDE_FIRST_ITERATION is the conflict type and INCLUDE is the resolution type. Multiple values for OVERRIDE_FIRST_ITERATION could be INCLUDE, SKIP, USE_LATEST_ON-PREVIOUS.
## Possible resolutions for OVERRIDE_FIRST_ITERATIONS CONFLICT
ARE include, skip, use_latest_on_previous

# conflict.OVERRIDE_FIRST_ITERATION=INCLUDE
WPCDelete Utility
This utility is applicable to Windchill PDMLink users.
Creo Packages creates temporary workspaces for users during a WPCExport operation. If the WPCExport does complete successfully, or if an abnormal condition arises, this utility deletes any temporary workspaces created by Creo Packages.
* 
Before running the WPCDelete utility, ensure that no other session is running on the machine, as it also deletes the Creo Packages workspace created in the other session.
Perform the following steps to run the WPCDelete utility.
1. From the command prompt, go to the %WPC_HOME%\bin directory.
2. Execute WPCDeleteWS.bat -<user> -<password>
3. A success or warning messages appears with the appropriate user action.
WPCProEShutdown Utility
Creo Packages allows Creo Parametric to run in shared mode. When Creo Parametric is shared, the Creo Packages client uses the available session, instead of creating a new session. A shared connection can be between two or more Creo Parametric users on the same client installation.
Perform the following steps to shut down the shared connections:
1. From the command prompt, go to the %WPC_HOME%\bin directory.
2. Execute WPCProEShutdown.bat -<user> -<password>
3. A success or warning messages appears with the appropriate user action.
Import Commands and Arguments
This section contains common Creo Packages commands and arguments used when importing a package to a target PLM system.
WPCImport Command
This section contains information about the complete, incremental, and synchronization package import. For detailed information about packages, see Complete, Incremental, and Synchronization Packages.
Complete, Incremental, and Synchronization Package Import
The arguments in the following table are common to the WPCImport command for a complete and incremental package import:
Argument (long format)
Argument (short format)
Required
Values
Description
-baseline folder
-a
No
Default: Value specified in preferences
Multiple values allowed: No
Where the baseline is created if the import succeeds.
If no value is specified in preferences, the baseline is not created.
-baseline folder “ORG1 /Library/PTC Library\baselines”
-preference
-e
No
Default: from load point wpc_preferences.txt
Multiple values allowed: No
Specifies the full path to the preferences file when the default path is not used. (Optional)
If wpc_preferences.txt doesn't exist, the default value is your system default value.
-folder
-f
No
Default: Specified in preferences
Multiple values allowed: No
Specifies where objects are imported. The origin of the object does not affect its destination.
This option is applicable for new objects only. Any existing objects follow the location for existing objects.
-folder PTCORG\Product/Product1\Foreign
-package
-g
No.
Default: Location specified in preferences, unless user enters -preview option
Multiple values allowed: No
Specifies the exact location of the package and the package name, when importing a package.
The package name may or may not contain an extension.
-package d:\cwp\packages\test
-preview
-v
No
Default: N/A
Multiple values allowed: Yes
Used to pre-generate the list of objects to be imported.
-help
-h
No
Default: N/A
Use to access command line help.
-mapping
-m
No
Default: Read from preferences
Multiple values allowed: No
Specifies the folder location where the mapping file is to found.
-mappingdir d:\work\packages\mappings
-validate
-v
No
Default: N/A
Multiple values allowed: No
Validates the package against target PLM system without attempting import and is used with the -package argument.
-package d:\work\packages\test.wpc -validate
-resolution
-s
No.
Default: N/A
Multiple values allowed: No
Specifies the full path to the conflict resolution file used as input.
-resolution d:\data\conflicts\test.csv
-user
-u
Yes
Default: N/A
Multiple values allowed: No
The user name of the PLM system being connected to.
-user <name>
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system.
-password
-p
Yes
Default: N/A
Multiple values allowed: No
The user password of the PLM system being connected to.
-password <name>
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system. The password characters are masked.
-output
-t
No
Default: Startup directory, unless specified in preferences.
Multiple values allowed: No
Specifies the location for the HTML page to be stored.
If the directory does not exist, create one.
Name of the output is assigned by Creo Packages.
-output d:\work\packages
Complete, Incremental, and Synchronization Package Import for Projects
The arguments in the following table are common to the WPCImport command for a complete, incremental, and synchronization package import for projects.
* 
The -context argument for import of project packages cannot be used in conjunction with object ownership transfer arguments.
Argument (long format)
Argument (short format)
Required
Values
Description
-context
-N
Yes
Default: N/A
Multiple values allowed: No
Specifies which context to work with. The value has to be unique per site with organization information.
-context
/PTC/Project/My_project
-baseline folder
-a
No
Default: Value specified in preferences
Multiple values allowed: No
Where the baseline is created if the import succeeds.
If no value is specified in preferences, the baseline is not created.
-baselinefolder “ORG1/Library/PTC Library\baselines”
-preference
-e
No
Default: from load point wpc_preferences.txt
Multiple values allowed: No
Specifies the full path to the preferences file when the default path is not used. (Optional)
If wpc_preferences.txt doesn't exist, the default value is your system default value.
-folder
-f
No
Default: Specified in preferences
Multiple values allowed: No
Specifies where objects are imported. The origin of the object does not affect its destination.
This option is applicable for new objects only. Any existing objects follow the location for existing objects.
-folder PTCORG\Product/Product1\Foreign
-package
-g
No.
Default: Location specified in preferences, unless user enters -preview argument
Multiple values allowed: No
Specifies the exact location of the package and the package name, when importing a package.
The package name may or may not contain an extension.
-package d:\cwp\packages\test
-preview
-v
No
Default: N/A
Multiple values allowed: Yes
Used to pre-generate the list of objects to be imported.
-help
-h
No
Default: N/A
Use to access command line help.
-mapping
-m
No
Default: Read from preferences
Multiple values allowed: No
Specifies the folder location where the mapping file is to found.
-mappingdir d:\work\packages\mappings
-validate
-v
No
Default: N/A
Multiple values allowed: No
Validates the package against target PLM system without attempting import and is used with the -package argument.
-package d:\work\packages\test.wpc -validate
-resolution
-s
No.
Default: N/A
Multiple values allowed: No
Specifies the full path to the conflict resolution file used as input.
-resolution d:\data\conflicts\test.csv
-user
-u
Yes
Default: N/A
Multiple values allowed: No
The user name of the PLM system being connected to.
-user <name>
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system.
-password
-p
Yes
Default: N/A
Multiple values allowed: No
The user password of the PLM system being connected to.
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system. The password is masked.
-password <name>
-output
-t
No
Default: Startup directory, unless specified in preferences.
Multiple values allowed: No
Specifies the location for the HTML page to be stored.
If the directory does not exist, create one.
Name of the output is assigned by Creo Packages.
-output d:\work\packages
Complete Package Import for Object Ownership Transfer
The arguments in the following table are common to the WPCImport command for a complete object ownership transfer package:
Argument (long format)
Argument (short format)
Required
Values
Description
-result Package
-y
No
N/A
Multiple values allowed: No
Specifies where the resulted Master synchronization package is created.
If this argument is not specified, one is created in the Startup directory.
-resultPackage d:\data\WPC\ownership
-result Baseline Folder
-a
No
Default: The one specified in preferences if any. If not, the export fails.
Multiple values allowed: No
Specifies where the baseline is created upon successful export.
-resultbaselinefolder “ORG1/Library/PTC Library\baselines”
-noResult Baseline
-S
No
N/A
Multiple values allowed: No
If this argument is specified, the resulting baselines after the ownership transfer package is created is ignored.
-preference
-e
No
Default: from load point WPC_preferences.txt
Multiple values allowed: No
Specifies the full path to the preferences file when the default path is not used. (Optional)
The default value is wpc_preferences.txt. If wpc_preferences.txt doesn't exist, the default value is your system default value.
-folder
-f
No
Default: Specified in preferences
Multiple values allowed: No
Specifies where objects are imported. The origin of the object does not affect its destination.
This option is applicable for new objects only. Any existing objects follow the location for existing objects.
-folder PTCORG\Product/Product1\Foreign
-package
-g
No.
Default: Location specified in preferences, unless user enters -preview option
Multiple values allowed: No
Specifies the exact location of the package and the package name, when importing a package.
The package name may or may not contain an extension.
-package d:\cwp\packages\test
-preview
-v
No
Default: N/A
Multiple values allowed: Yes
Used to pre-generate the list of objects to be imported.
-help
-h
No
Default: N/A
Use to access command line help.
-mapping
-m
No
Default: Read from preferences
Multiple values allowed: No
Specifies the folder location where the mapping file is to found.
-mappingdir d:\work\packages\mappings
-validate
-v
No
Default: N/A
Multiple values allowed: No
Validates the package against target PLM system without attempting import and is used with the -package argument.
-package d:\work\packages\test.wpc -validate
-resolution
-s
No.
Default: N/A
Multiple values allowed: No
Specifies the full path to the conflict resolution file used as input.
-resolution d:\data\conflicts\test.csv
-user
-u
Yes
Default: N/A
Multiple values allowed: No
The user name of the PLM system being connected to.
-user <name>
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system.
-password
-p
Yes
Default: N/A
Multiple values allowed: No
The user password of the PLM system being connected to.
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system. The password is masked.
-password <name>
-output
-t
No
Default: Startup directory, unless specified in preferences.
Multiple values allowed: No
Specifies the location for the HTML page to be stored.
Name of the output is assigned by Creo Packages.
-output d:\work\packages
If the directory does not exist, create one.
Master Synchronization Package for Object Owner Transfer
The arguments in the following table are common to the WPCImport command used in a master synchronization package for an object ownership transfer:
Argument (long format)
Argument (short format)
Required
Values
Description
-resultPackage
-y
No
N/A
Multiple values allowed: No
Specifies where the resulted master synchronization package is created.
If this argument is not specified, one is created in the startup directory.
-resultPackage d:\data\WPC\ownership
-baselinefolder
-a
No
Default: Value specified in preferences
Multiple values allowed: No
Where baseline will be created if the import succeeds.
If no value is specified in preferences, baseline is not created.
-baselinefolder “ORG1/Library/PTC Library\baselines”
-resultBaselineFolder
-a
No
Default: The one specified in preferences if any. If not, the import fails.
Multiple values allowed: No
Specifies where the baseline is created upon successful import.
-resultbaselinefolder “ORG1/Library/PTC Library\baselines”
-noresultBaseline
-S
No
N/A
Multiple values allowed: No
If this argument is specified, the resulting baselines after the ownership transfer package is created is ignored.
-preference
-e
No
Default: from load point wpc_preferences.txt
Multiple values allowed: No
Specifies the full path to the preferences file when the default path is not used. (Optional)
If wpc_preferences.txt. doesn't exist, the default value is your system default value.
-folder
-f
No
Default: Specified in preferences
Multiple values allowed: No
Specifies where objects are imported. The origin of the object does not affect its destination.
This option is honored for new objects only. Any existing objects follow the location for existing objects.
-folder PTCORG\Product/Product1\Foreign
-package
-g
No.
Default: Location specified in preferences, unless user enters -preview option
Multiple values allowed: No
Specifies the exact location of the package and the package name, when importing a package.
The package name may or may not contain an extension.
-package d:\cwp\packages\test
-preview
-v
No
Default: N/A
Multiple values allowed: Yes
Used to pre-generate the list of objects to be exported.
-help
-h
No
Default: N/A
Use to access command line help.
-mapping
-m
No
Default: Read from preferences
Multiple values allowed: No
Specifies the folder location where the mapping file is to found.
-mappingdir d:\work\packages\mappings
-validate
-v
No
Default: N/A
Multiple values allowed: No
Validates the package against target PLM system without attempting import and is used with the -package argument.
-package d:\work\packages\test.wpc -validate
-resolution
-s
No.
Default: N/A
Multiple values allowed: No
Specifies the full path to the conflict resolution file used as input.
-resolution d:\data\conflicts\test.csv
-user
-u
Yes
Default: N/A
Multiple values allowed: No
The user name of the PLM system being connected to.
-user <name>
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system.
-password
-p
Yes
Default: N/A
Multiple values allowed: No
The user password of the PLM system being connected to.
The user name and password arguments are optional. If they are not entered upon execution of the command, Creo Packages prompts you to enter a user name and password to help provide increased security for your system. The password is masked.
-password <name>
-output
-t
No
Default: Startup directory, unless specified in preferences.
Multiple values allowed: No
Specifies the location for the HTML page to be stored.
If the directory does not exist, create one.
Name of the output is assigned by Creo Packages.
-output d:\work\packages
WPCImport Command Syntax/Usage Example
WPCImport.bat -user %user_name% -password %user_password% -package
d:\work\packages\test.wpc -validate
WPCView Command
The arguments in the following table are common to the WPCView command:
Argument (long format)
Argument (short format)
Required
Values
Description
-package
-g
Yes
Default: N/A
Multiple values allowed: No
Specifies the name and full path of the previously created package that the user wants to view.
-package d:\work\packages\test.wpc
-output
-t
No
Default: Startup directory, unless specified in preferences.
Multiple values allowed: No
Specifies the location for the HTML page to be stored.
If the directory does not exist, create one.
Name of the output is assigned by Creo Packages.
-output
d:\work\packages
WPCView Command Syntax/Usage Example
usage: WPCView -package(-g) [-output(-t) ] [-help(-h) ]
WPCView Command Example
WPCview.bat -package d:\cwp\packages\test.wpc