Quick question. Im looking to add a timestamp to command below. My challenge is that it must be a single command (one liner, as opposed referring to a variable in a previous step) and i cant use double-quotes ("), just single quotes
One more (creativity) question with the same requirements as above. So following the same command as above, is it possible to join multiple objects using a one-liner. I assume the answer is no, but asking anyways. Im looking for Username,ShareName,ComputerName. So display as the following:
Putting everything on one line is not a best practice for script.
It makes them hard to read, debug, maintain and pass on. Just as if one put a whole paragraph in a book on one line of uses unnecessary run-on sentences.
In an interactive session, most of the time, then most certainly.
If your code / comment / example line in a script will not fit the width of a normal 8.5x11 piece of paper, Word doc for example, then it is too long (though there are times when it cannot be avoided), and you need to leverage natural line breaks / continuation and PowerShell splitting …
Having to scroll hundreds of characters across a screen to see code, is just, self-imposed and transferred torture. Just say’in… Yes, I’ve had to deal with that more that I’d like. The longest so-called one-liner some one threw at me to fix / troubleshoot, was literally 300 characters. Needles to say, I had very terse chat with that person. ;-} Will it change them , who knows.
… or even the often maligned backtick (this last one does have its place / use case IMHO).
David, the one-liner requirement is because im running a remote utility which executes each line at a time as a new PS process. I could put it all together in a ps1, send it down and run the file, but it involves extra steps.
Postanote, i agree with you. You’re spot on. Unfortunately though, thats a limitation im facing while using this tool