我正在使用以下命令使用 PowerShell 脚本创建此文本文件:
param ([string] $dllPath = $null,[string] $textFile = $null)
$version = [System.Reflection.Assembly]::LoadFrom($dllPath).GetName().Version.ToString()
$version > $textFile
文本文件未使用 ANSI 编码创建,因此无法使用批处理文件读取。
现在,我将上面的代码更改如下,它正在工作。
param ([string] $dllPath = $null,[string] $textFile = $null)
$version = [System.Reflection.Assembly]::LoadFrom($dllPath).GetName().Version.ToString()
$version | Out-File $textFile -Encoding Ascii
我可以使用以下命令读取文本文件内容
set /p ClientSideUnitTestDestinationLocation=<%scriptLocation%\assemblyVersion.txt
Echo %ClientSideUnitTestDestinationLocation%