pasteasreference
Description
Appends one custom reference file to a source file or to files found by search in SOLIDWORKS PDM.
The pasteasreference command uses filePath as the reference file to append. Use source to append that reference to one file, or use search to append that reference to multiple matching files.
This command is useful when a workflow creates or finds a supporting file and then needs to append it as a custom reference to one or more target files.
Syntax
pasteasreference -filePath reference_file (-source source_file | -search search_query) [-recursive]
Use -id as an alternative to -filePath for the same operand. A required target still needs one selector, even though each alternative is optional individually. See File IDs and paths for selection rules and command-specific exceptions.
Parameters
| Parameter | Alias | Required | Description |
|---|---|---|---|
-filePath |
No | Reference file to append to the selected source/search files. | |
-source |
No | Source file that will receive the appended custom reference. Use either -source or -search. | |
-search |
No | Search query used to find files that will receive the appended custom reference. Use either -source or -search. | |
-recursive |
No | When used with search, includes matching files in subfolders. | |
-id |
No | Positive PDM file ID instead of -filePath, identifying the same file that -filePath describes (including a macro, input CSV or existing output file). Requires a connected vault. Shared files with multiple locations require an exact -filePath. Resolving the ID itself does not download, check out or check in the file; the requested command still performs its normal operation. |
More about parameters
filePathRequired. Reference file to append.sourceOptional. Single file that will receive the appended reference. Use eithersourceorsearch.searchOptional. Search query used to find files that will receive the appended reference. Use eithersourceorsearch.recursiveOptional. When used withsearch, includes matching files in subfolders.
Validation
filePathis required.- Specify either
sourceorsearch, but not both. recursiveis only valid when used withsearch.
Behavior
- Appends the
filePathreference to each selected target file. - Does not clear existing custom references.
- Uses a quantity of
1for the appended custom reference. - Skips a target file if it is the same file as
filePath. - Skips duplicates.
Examples
# pasteasreference
pasteasreference -filePath "Part.sldprt" -source "Assembly.sldasm"
# pasteasreference
pasteasreference -filePath "Part.sldprt" -search "Name=%.sldasm"
# pasteasreference
pasteasreference -filePath "Part.sldprt" -search "Name=%.sldasm" -recursive
Remarks
- This command modifies custom references directly in SOLIDWORKS PDM.
- Existing custom references are preserved.
- If the selected target already has the reference, PDMShell reports it and does not add a duplicate.
Search results report
Add -csv "C:\Reports\results.csv" when using -search to save operation results. The first columns are file ID, parent folder ID, file name and output, followed by status and error details. The report folder must exist. New vault reports are added to PDM; existing vault reports must be checked out by you on this computer and remain checked out. External reports are replaced. See CSV operation reports for command-specific outcomes.