Buenos días a todos,
Desde un servidor SMTP estoy intentando enviar archivos adjuntos a diferentes personas.
El guión funciona correctamente.
El único problema es que cuando agrego "!//" al comienzo de mi script para que se ejecute directamente, aparece el siguiente error:

Aquí está el script que uso:
//!
Names Default To Here( 1 );
// modifier le type de codage dans le PowerShell (windows)
stringCommand = "$OutputEncoding = [System.Text.Encoding]::UTF8";
// paramètres du mail à envoyer
commands = {
"Send-MailMessage -From '... -To '...' -Subject 'test' -Body 'test' -SmtpServer... -Attachment "test...",
"exit\!n"
};
// script exécution PowerShell
icommand = 0;
RP = Run Program(
Executable( "PowerShell.exe", stringCommand, ShowWindow("Hide") ),
ReadFunction( Function( {this}, Write( this << Read ) ) ),
WriteFunction(
Function( {this},
icommand++;
If( icommand <= N Items( commands ),
this << Write( commands[icommand] );
,
this << WriteEOF;
);
)
)
);Gracias por su ayuda !