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

Problem with invoking command line from PowerShell

$
0
0

Hello 

can someone please help me with the following problem

if I run he command line from DOS

"C:\Program Files\Java\jdk1.7.0_67\bin\jarsigner.exe" "C:\TestFiles\TestJar6.jar" certreq-MyStore-31087891-2c3d-4695-9b0f-e669f8820331 -keystore "F:\InfoSec\LVInfoSecCodeSigning.keystore" -storepass MyPassword1 -keypass MyPassword2 -tsa https://timestamp.geotrust.com/tsa -J-Dhttps.proxyHost=MyProxy -J-Dhttps.proxyPort=81

it works fine

If I run from PowerShell

& "C:\Program Files\Java\jdk1.7.0_67\bin\jarsigner.exe" "C:\TestFiles\TestJar6.jar" certreq-MyStore-31087891-2c3d-4695-9b0f-e669f8820331 -keystore "F:\InfoSec\LVInfoSecCodeSigning.keystore" -storepass MyPassword1 -keypass MyPassword2 -tsa https://timestamp.geotrust.com/tsa -J-Dhttps.proxyHost=MyProxy -J-Dhttps.proxyPort=81

I get the message 

Only one alias can be specified

Please type jarsigner -help for usage

Meaning when JarSigner.exe parsed the command line it thinks I am specifying two aliases the alias is the parameter certreq-MyStore-31087891-2c3d-4695-9b0f-e669f8820331

Now if I remove the following parts of the overall command like 

 -tsa https://timestamp.geotrust.com/tsa -J-Dhttps.proxyHost=MyProxy -J-Dhttps.proxyPort=81

and leave like this 

& "C:\Program Files\Java\jdk1.7.0_67\bin\jarsigner.exe" "C:\TestFiles\TestJar6.jar" certreq-MyStore-31087891-2c3d-4695-9b0f-e669f8820331 -keystore "F:\InfoSec\LVInfoSecCodeSigning.keystore" -storepass MyPassword1 -keypass MyPassword2

it works fine, e.g. JarSigner.exe parses the  line and understands it including the alias

So it is when I introduce  

-tsa https://timestamp.geotrust.com/tsa -J-Dhttps.proxyHost=MyProxy -J-Dhttps.proxyPort=81

then JarSigner.exe can no longer parse it correctly, hence the error (but OK from DOS)

However i need to do this so have no choice but to get it to work.

I believe someone on this forum previously wrote a function to deal with helping PowerShell parse command line exe with arguments, which may help me overcome this issue.

I have tried changing the order of the parameters etc, by putting the alias at the end etc, but same issue

Any help most welcome

AAnotherUser__

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles