@REM This will work from a .BAT or .CMD file, or from the CMD console. @REM It's too slow to be used for regular work but it's OK for debugging and troubleshooting. @REM It's mainly about enforcing a standard format to make it easier to parse the log file later. PowerShell -noprofile -nologo -command "$LogLevel = 'INFO'; $Message = 'Something notable happened';$OutputTemplate = '{0},{1},{2},{3}'; Add-Content -path .\Simple.log.txt -value ($OutputTemplate -f @((Get-Date).ToString('s'), $LogLevel, $ENV:UserName, $Message) ) "