public static void RunScript(string fileName) { var cwd = Environment.CurrentDirectory; try { var fullPath = Path.GetFullPath(fileName); var directory = Path.GetDirectoryName(fullPath) ?? Environment.CurrentDirectory; using (var scope = new TestScope(fileName)) { var exitCode = SilentProcessRunner.ExecuteCommand( "PowerShell.exe", FormatCommandArguments(fullPath), directory, scope.StdOut, scope.StdErr ); scope.Exited(exitCode); } } finally { Environment.CurrentDirectory = cwd; } }