a Powershell le falta el terminador: "
Tengo el siguiente código de script
#[string]$password = $( Read-Host "Input password, please" )
param (
[string]$ReleaseFile = $(throw "-ReleaseFile is required"),
[string]$Destination = $(throw "-Destination is required")
)
function unzipRelease($src, $dst)
{
$shell = new-object -com shell.application
$zip = $shell.NameSpace($src)
foreach($item in $zip.items())
{
$shell.Namespace($dst).copyhere($item)
}
}
# .\deployrelease.ps1 -ReleaseFile ".\deploy.zip" -Destination "."
unzipRelease –Src '$ReleaseFile' -Dst '$Destination'
Corro el script con: .\deployrelease.ps1-ReleaseFile ".\desplegar.zip "- Destino"."
Pero sigo recibiendo esto:
PS C:\Users\Administrator\Documents\Tools> .\deployrelease.ps1 -ReleaseFile ".\deploy.zip" -Destination
The string starting:
At C:\Users\Administrator\Documents\Tools\deployrelease.ps1:19 char:16
+ unzipRelease â? <<<< "Src '$ReleaseFile' -Dst '$Destination'
is missing the terminator: ".
At C:\Users\Administrator\Documents\Tools\deployrelease.ps1:19 char:55
+ unzipRelease â?"Src '$ReleaseFile' -Dst '$Destination' <<<<
+ CategoryInfo : ParserError: (Src `'$ReleaseF...'$Destination`':String) [], ParseException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
No pude encontrar la solución ya que no veo ningún problema.
Alguna ayuda?
34
Author: ROMANIA_engineer, 2013-12-20
2 answers
Mira de cerca los dos guiones en
unzipRelease –Src '$ReleaseFile' -Dst '$Destination'
Este primero no es un guion normal sino un guion en (–
en HTML). Reemplace eso con el guion que se encuentra antes de Dst
.
89
Author: Tim Pietzcker,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-20 15:31:40
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-20 15:31:40
En su script, ¿por qué está utilizando comillas simples alrededor de las variables? Estos no se ampliarán. Use comillas dobles para la expansión de variables o solo los nombres de las variables.
unzipRelease –Src '$ReleaseFile' -Dst '$Destination'
A
unzipRelease –Src "$ReleaseFile" -Dst "$Destination"
2
Author: Jacob,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-03 22:03:26
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-03 22:03:26