diff --git a/Utilities.cmake b/Utilities.cmake
index 562e948..d2d3530 100644
--- a/Utilities.cmake
+++ b/Utilities.cmake
@@ -633,9 +633,11 @@ file(TO_NATIVE_PATH "${file_path}" ntv_file_path)
 # This converts #undefs into #cmakedefines so configure_file can handle it
 set(PS_CMD
 "Get-Content \"${ntv_file_path}\" |
-ForEach { 
+ForEach {
 if($_ -match '^#undef[ \t]*[^ \t]*')
-  { $_ -replace '^#undef[ \t]*([^ \t]*)','#cmakedefine $1 @$1@' } else {$_}}"
+  { $_ -replace '^#undef[ \t]*([^ \t]*)','#cmakedefine $1 @$1@' } else {$_}
+} |
+Set-Content \"${ntv_file_path}.cmake\""
 )
 
 if(EXISTS ${file_path})
@@ -646,9 +648,8 @@ if(EXISTS ${file_path})
     # Convert autoconf .in into a cmake .in
     execute_process(COMMAND powershell -Command "${PS_CMD}" 
         RESULT_VARIABLE error_level
-        ERROR_VARIABLE error_output
-        OUTPUT_FILE ${file_path}.cmake)
-        
+        ERROR_VARIABLE error_output)
+
     if(NOT ${error_level} EQUAL 0)
         message(FATAL_ERROR "Powershell completed with ${error_level} : ${error_output}")
     endif()