public WindowsCommands WithCommands(string commands) { //Console.WriteLine($"PS> {commands.Replace("`n", " ; ")}"); Log($"PS> {commands}"); UserData.AddCommands($"{commands}"); return(this); }
public WindowsCommands Log(string s = null) { if (!string.IsNullOrWhiteSpace(LogFilePath)) { UserData.AddCommands($"Add-Content -Path \"{LogFilePath}\" -Force -Value \"{(string.IsNullOrWhiteSpace(s)?"":$"$(Get-Date -Format \"HH:mm:ss.fff\"): {PowerShellValue(s)}")}\""); } return(this); }