2017-05-12 29 views
1

我想通過TFS中的powershellscript運行sqlplus。我有一個deployment.xml文件,其中有部署sql腳本的順序。我的PS腳本讀取deployment.xml文件,然後執行sqlplus命令。在deployment.xml中有3個文件PowerShell無法讀取文件名中的空間

  1. 新的SQL FILE.sql
  2. sample.sql
  3. dfg_ehl.sql

有名稱空間中的第一個文件是沒有得到閱讀並投擲

error: Cannot open the file because file doesn't exists.

我試過重命名,替換和複製文件,但PS腳本仍然失敗,

error"Cannot find path C:...\NEW SQL FILE.sql because it does not exists".

我也使用雙引號,但不起作用。這裏是我的代碼:

param($username,$password,$schema,$sqlpath) 
$xml=[xml] Get-Content deployment.xml 
$Query=$xml.deployment.script 
Set-Location $sqlpath 
foreach($q in $Query) 
{ 
    sqlplus $username/[email protected]$schema "@$q" 
} 

Deployment.xml 
<deployment> 
<script>NEW SQL File.sql</script> 
<script>sample.sql</script> 
</deployment> 

請幫忙。 此腳本不起作用並拋出

"Cannot find path "C:..\NEW SQL File.sql" as it does not exists.

回答