Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

This shouldn't be that hard but it is!

$
0
0

I need to excecute this command (which works perfectly in command prompt)

c:\filesize\testing\dcmdump.exe -v -M +P "0002,0016" -s -q C:\FileSize\testing\1.dcm

 

The closest I have gotten is this:

 

cls

$dcmdump="c:\filesize\testing\dcmdump.exe"

$switch="-v -M +P `"0002`,0016`" -s -q"

$file="C:\FileSize\testing\1.dcm"

$comd="$dcmdump$switch$file"

Write-Output$comd    ##for a scanity check###

&$comd

 

My write-output sanity check line returns fine, however the execution appears to barf – I’m certain that it’s the double quotes in the $switch that’s doing it

c:\filesize\testing\dcmdump.exe -v -M +P "0002,0016" -s -q C:\FileSize\testing\1.dcm

& : The term 'c:\filesize\testing\dcmdump.exe -v -M +P "0002,0016" -s -q C:\FileSize\testing\1.dcm' is not recognized as the name of a

cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is

correct and try again.

At line:7 char:3

+ & $comd

+   ~~~~~

    + CategoryInfo          : ObjectNotFound: (c:\filesize\tes...e\testing\1.dcm:String) [], CommandNotFoundException

    + FullyQualifiedErrorId :CommandNotFoundException

 

Am I missing something here or is this unusually difficult?

I'm on Powershell v4


Viewing all articles
Browse latest Browse all 6937

Trending Articles