Application : quiet install command with powershell command

BESANÇON Ludovic 136 Reputation points
2020-12-17T10:21:05.617+00:00

Hi,

I would like to create a standard Application with powershell commands.
I make it with a script, in the Quiet install commad I strike : powershell.exe -ExectutionPolicy ByPass .\myScript.ps1
And it works fine.
But if I strike : powershell.exe -noExit -noProfile -Command '& {'& {$Env:ProgramFiles;Copy-Item .* "$Env:ProgramFiles\WindowsPowerShell\Modules" -Recurse -Force -WhatIf;Read-Host "Wait !!!"}'
I got in my powershell console just the string, not the execution of the string.

What is the right expression to use ?

Thank you for your help.

Ludovic.

Microsoft Deployment Toolkit
Microsoft Deployment Toolkit
A collection of Microsoft tools and documentation for automating desktop and server deployment. Previously known as Microsoft Solution Accelerator for Business Desktop Deployment (BDD).
840 questions
0 comments No comments
{count} votes

Accepted answer
  1. BESANÇON Ludovic 136 Reputation points
    2020-12-17T14:00:33.79+00:00

    powershell.exe /? help me !!!

    Pour écrire une chaîne qui exécute une commande Windows PowerShell,
    utilisez le format :
        "& {<commande>}"
    où les guillemets indiquent une chaîne et l’opérateur d’appel (&)
    entraîne l’exécution de la commande.
    

    I change my ' by " and adapt my " by ' and it works fine now.

    Ludovic.

    0 comments No comments

0 additional answers

Sort by: Most helpful