0

I am writing one PowerShell script which is reading a CSV file and in that script I am passing Dimension commands . One command is for connecting to serena dimensions and another is for fetching files from dimensions.

dmcli FI $Specification /USER_FILENAME=$FilePath

Here

  • $specification is a value from the CSV file
  • $filepath is the path to store the downloaded file

The above code is to fetch code from dimensions and copy into the folder.

The code is working fine but failed for filenames and specification having space.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Pranathy
  • 49
  • 5

1 Answers1

0

Put the arguments in double quotes:

dmcli FI "$Specification" "/USER_FILENAME=$FilePath"

or like this:

dmcli FI "$Specification" /USER_FILENAME="$FilePath"

If that doesn't work try running the command in CMD with environment variables:

$env:Specification = $Specification
$env:FilePath      = $FilePath

& cmd /c 'dmcli FI "%Specification%" /USER_FILENAME="%FilePath%"'
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328