示例#1
0
 public WindowsCommands WithCommands(string commands)
 {
     //Console.WriteLine($"PS> {commands.Replace("`n", " ; ")}");
     Log($"PS> {commands}");
     UserData.AddCommands($"{commands}");
     return(this);
 }
示例#2
0
 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);
 }