问题描述
我有一个批处理脚本来自动化一些操作。 此代码采用 .osis.xml 文件并将其转换为 Osis 格式,以便在某些圣经程序中阅读。
SET work=D:\Documents\Downloads\Emule-Incoming\osis\
osis2mod %work% - < cei1974.osis.xml
现在我正在尝试将我的批处理脚本转换为 PS 脚本。这是我现在所做的:
# $work variable contains the path of the folder with the original files.
$work = "D:\Documents\Downloads\Emule-Incoming\osis"
# $bpc variable contains the path of destination of CONF files for BPBiblePortable
$bpc = "D:\Documents\Downloads\Emule-Incoming\BPBiblePortable\App\BPBible\resources\mods.d\"
# $xic contains the path of destination of CONF files for xiphos
$xic = "C:\Users\Emanuele\AppData\Roaming\Sword\mods.d\"
# $bpo contains the path of destination of OSIS files for BPBiblePortable
$bpo = "D:\Documents\Downloads\Emule-Incoming\BPBiblePortable\App\BPBible\resources\modules\texts\rawtext\"
# $xio variablecontains the path of destination of OSIS files for xiphos.
$xio = "C:\Users\Emanuele\AppData\Roaming\Sword\modules\texts\rawtext\"
# $Confile Array contains the names of .conf files.
$Confile = @('cei1971.conf','cei1974.conf','cei2008.conf','tilc.conf','novav.conf')
foreach ($element in $Confile)
{
# The copy of the files goes well
copy-Item -Path $work\$element -Destination $bpc
$wshell = New-Object -ComObject Wscript.Shell
$count = 1
$result = 0
While ($result -eq 0)
{
$result = $wshell.Popup("copiato in $bpc",1,"$element",0)
$count += 1
Write-Host $count
if($count -eq 10)
{
Exit
}
}
copy-Item -Path $work\$element -Destination $xic
$wshell = New-Object -ComObject Wscript.Shell
$count = 1
$result = 0
While ($result -eq 0)
{
$result = $wshell.Popup("copiato in $xic",0)
$count += 1
Write-Host $count
if($count -eq 10)
{
Exit
}
}
}
# The name of the .exe.
$eseguibile = "osis2mod.exe"
#
# THIS IS THE COMMAND I'M NOT ABLE TO "translate" in PS
# The problem is that PS not recognize the "- <" passing
#
& $PSScriptRoot\$eseguibile --% $work\ - < $work\cei1974.osis.xml
有人找到像我一样的东西吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)