I have a following batch(.bat file) command which is working great. However, i need to convert it into powershell command and need to run it through powershell. I have went through different ways that i have found online but none of them seems to work the way i want it to.
Batch command:
java -jar xyz.jar -url https://xyz.abc.com -user xyz123 -passwordHash abchgfqwfjhd1232bfyevt7676 -clientId GFGFhjxgsVGGF -clientSecret GFhjdhjdhdGGGbfsilwueibJGBjg -input C:\abc\Newfolder\xyz\ -v >> %logfile%
Till now i have just been able to run this basic powershell command. can someone please assist?
Powershell command:
Start-Process -FilePath https://xyz.abc.com
Maybe this helps:
$logFile = "C:\temp\logFile.txt"
Invoke-Expression "java -jar xyz.jar -url https://xyz.abc.com -user xyz123 -passwordHash abchgfqwfjhd1232bfyevt7676 -clientId GFGFhjxgsVGGF -clientSecret GFhjdhjdhdGGGbfsilwueibJGBjg -input C:\abc\Newfolder\xyz\ -v " | Out-File $logFile
Invoke-Expression
docu, be aware that Invoke-Expression
should only be used if the string you're invoking is under your control. Another alternative is the &
(call-operator), check this stackoverflow answer, which explains the differences between them.
Hope that helps.