From cbcf974e57be2c9a03a1392dbcd448a8156c9731 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 4 Nov 2015 10:55:06 -0800 Subject: [PATCH] Execute *.ps1 arguments as scripts --- src/host/main.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/host/main.cs b/src/host/main.cs index 350dfec21f..23ec9cd3cd 100644 --- a/src/host/main.cs +++ b/src/host/main.cs @@ -92,9 +92,13 @@ namespace Microsoft.Samples.PowerShell.Host if (hasNext && arg == "--file") { - initialScript = File.ReadAllText(nextArg); + initialScript = Path.GetFullPath(nextArg); ++i; } + else if (arg.EndsWith(".ps1")) + { + initialScript = Path.GetFullPath(arg); + } else if (hasNext && arg == "--working-dir") { Directory.SetCurrentDirectory(nextArg);