1

I am trying to execute this powershell script

Write-output `n "\\Latest Modified Mobile file is"
$dir = "\\sharepoint.amr.ith.intel.com@SSL\sites\peca\PTA Data Sandbox\Shared Documents\Under_review\Regina\Estimates"
$filter="*EstimateImport_Mobile_*.xlsx"
$latest = Get-ChildItem -Path $dir -Filter $filter | Sort-Object LastAccessTime -Descending | Select-Object -First 1
$latest.Name

if($?)
{
   "command succeeded"
}
else
{
   "command failed"
}

& "C:\PECA Data Estimates Importer\PECA Estimates Importer.exe" import -i $latest.FullName

if($?)
{
  "command succeeded"
}
else
{
 "command failed"
}

Start-Sleep -s 5

exit

when I am using the "&" operator, it runs some windows .exe tool but on the screen I don't see any message, I want to see a message like "Running tool" on a powershell ISE so that the user knows that the script is still working.

1 Answer 1

1

If you want to see output on the screen, don't use Write-Output.

Use Write-Host to write text that will always be seen. Use Write-Verbose to write text that will only be seen in verbose mode.

Sign up to request clarification or add additional context in comments.

1 Comment

Even after personally editing the code blocks into the original question, I totally missed that the asker was utilizing Write-Output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.