8
Does Out-Host also signify Copy-Item has finished (as Out-Null does)?
(programming.dev)
PowerShell (POSH) is a a task automation command-line shell and scripting language created by Microsoft. It became part of the FOSS community in 2016 and is now available across Windows, Linux, and macOS
I'm not at all computer, but I believe
Out-Nullis used as "don't give me any output",Out-Fileis used as "put the output in this file", andOut-Hostis similar to the standard output in the terminal.What I would do is something like this (I'm not at a computer to test this):
Or if you want the actual output, this will store the result to the file and the screen/host:
Thanks for the reply.
I think your first option can give a false positive if the file is started to exist but hasn’t been completely written to. (Except if
Out-Filealready implies that it’s done being written, so the next part isn’t really needed.)The second one is good, but I don’t need console output. Just logging.
I’m looking for confirmation that both
Out-NullandOut-Filehave the same (side) effect of making sure the file is done being copied before continuing to the next line of the script. If so, I’ll stick withOut-FileOh my bad, I misunderstood your question initially. Yes,
Out-Filewill wait for the previous command to finish just likeOut-Null.awesome