Windows 10: Fix: Cannot run Executables with parameters using PowerShell

Discus and support Fix: Cannot run Executables with parameters using PowerShell in Windows 10 Tutorials to solve the problem; When running a command in-line PowerShell with parameters usually you would do this like & "ipconfig.exe /all". When you run it like that you will get... Discussion in 'Windows 10 Tutorials' started by Noel, Jun 21, 2018.

  1. Noel New Member

    Fix: Cannot run Executables with parameters using PowerShell


    When running a command in-line PowerShell with parameters usually you would do this like & "ipconfig.exe /all". When you run it like that you will get the error saying that it is not recognized.

    & : The term 'ipconfig.exe /all' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

    At line:1 char:3
    + & "ipconfig.exe /all"
    + ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (ipconfig.exe /all:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    This happens due to the fact that the parameters are causing this error. We need to split the parameters from the actual command by running them as below

    $Exec = "ipconfig.exe"
    $Parm = "/all"
    $Parm = $Parm.Split(" ")
    & "$Exec" $Parm



    (17)

    read more...
     
  2. ryanly Win User

    GPU-Z what command line parameter ?

    Current /? (-?) or / help (-help) parameter is invalid
     
    ryanly, Jun 21, 2018
    #2
  3. A123 Win User
    Set Execution Policy in Powershell

    I set the Execution Policy in Powershell to unrestricted to run a couple of command lines and then set the policy back to restricted. Does setting the policy to unrestricted for a small period of time harm Windows 10? Does one have to set the policy back
    to restricted or does closing Powershell and relaunching Powershell put the policy back to restricted?
     
  4. Deepak_Krishnan R Win User

    Fix: Cannot run Executables with parameters using PowerShell

    Set Execution Policy in Powershell

    Hi,

    Thank you for posting your query in Microsoft Community.

    I will surely assist you with your query.

    The execution policy is part of the security strategy of Windows PowerShell. It determines whether you can load configuration files (including your Windows PowerShell profile) and run scripts, and it determines which scripts, if any, must be digitally signed
    before they will run.

    Please refer to the link below to know more about Set Execution policy.

    https://technet.microsoft.com/en-us/library/hh849812.aspx

    Hope the above information helps.

    Thank you.
     
    Deepak_Krishnan R, Jun 21, 2018
    #4
Thema:

Fix: Cannot run Executables with parameters using PowerShell

Loading...
  1. Fix: Cannot run Executables with parameters using PowerShell - Similar Threads - Fix Cannot run

  2. Cannot login Windows PowerShell

    in Windows 10 Network and Sharing
    Cannot login Windows PowerShell: I use Win 10, we use Office 365 account. I am GA. I cannot login PowerShell. Got the error: "import-possession : Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files." I tried another GA account...
  3. Powershell: Add-VpnConnectionTriggerDnsConfiguration missing -AllUserConnection parameter

    in Windows 10 Network and Sharing
    Powershell: Add-VpnConnectionTriggerDnsConfiguration missing -AllUserConnection parameter: I've set up a split-tunnel VPN connection, and am trying to force that connection to use the remote connection's DNS server. To do this, I'm trying to use Add-VpnConnectionTriggerDnsConfiguration in PowerShell. However, the VPN connection is in the Global Phone Book....
  4. Execute Powershell command on remote computer

    in Windows 10 Network and Sharing
    Execute Powershell command on remote computer: Hello, I would like to execute a PowerShell command on a remote computer. The command is the following: Invoke-Command -ComputerName 10.40.27.174 -ScriptBlock { Get-ChildItem C:\ } -credential User I get the following error: [10.40.27.174] La connexion au serveur...
  5. Run Multiple Commands In Powershell?

    in Windows 10 Performance & Maintenance
    Run Multiple Commands In Powershell?: Hi, I have three drives in my PC. Two of them are SSD's and the third one is a mechanical HDD. I like to optimize them using Powershell. However, as it stands now. I'm running the commands separately for each of my drive, i.e. 1.) Optimize-Volume -DriveLetter C -ReTrim...
  6. Help with this result using Powershell to fix start button

    in Windows 10 Support
    Help with this result using Powershell to fix start button: I run the Powershell command that is supposed to fix the Start button fail (as well as Cortansa etc) and I got this message that I don't know how to interpret. I made sure that Windows Firewall was running too. 'Windows cannot install package...
  7. Cannot Set Execution Policy in Powershell

    in Windows 10 Support
    Cannot Set Execution Policy in Powershell: Did not experience this problem until this build (10130) but it may have occurred in the build before that also. As you can see in the attachment, I am in Administrator mode but cannot run a script which installs a dozen or so programs. The programs install if I type a...
  8. Run Multiple Commands In Powershell?

    in Windows 10 Performance & Maintenance
    Run Multiple Commands In Powershell?: Good job, @lx07. Of course, you had the benefit of knowing the OP wanted to run the same command on 3 targets. Had I been armed with that same information, I might have made that same suggestion, too. That's why we're better working together than working individually. --Ed--
  9. Running Powershell for login of users

    in Windows 10 Support
    Running Powershell for login of users: I'd like to place a batch file in task scheduler and run simple uninstalling of the live tiles on windows. I have ran these separately but it would be perfect for anyone who logs into our domain on the pc would get these icons removed as well. Possible even run this in...
  10. Change PowerShell Script Execution Policy in Windows 10

    in Windows 10 Tutorials
    Change PowerShell Script Execution Policy in Windows 10: I ran Option 2 which gave the settings below. How do I reset the permissions back to the default Undefined? [img] 54585