Windows 10: Powershell with CMD/c to run external command with Parameters

Discus and support Powershell with CMD/c to run external command with Parameters in Windows 10 Customization to solve the problem; Greeting, I have an old command line application call Commandline.exe. it run with a parameter to check then show the result. but it need extra... Discussion in 'Windows 10 Customization' started by userausera, Jul 14, 2020.

  1. Powershell with CMD/c to run external command with Parameters


    Greeting,


    I have an old command line application call Commandline.exe. it run with a parameter to check then show the result. but it need extra "Enter" to confirm


    like:

    commandline.exe -s 4567890


    So I preparing the an answer file which is on an "Enter" crlf inside it. called c:\apps\answer.txt.

    use line: pipe to feed commandline.exe that "Enter"

    type c:\apps\answer.txt c:\apps\commandline.exe -s 4567890


    So in powershell I assembly them together like below,


    cmd /c type c:\apps\answer.txt c:\apps\commandline.exe -s 4567890


    It works in powershell command line. but with other code together it not


    $cmd="type c:\apps\answer.txt c:\apps\commandline.exe -s 4567890"


    The idea is parameter 45567890 is other code created, do not want to be clear text on the command line.



    Thanks and Best Regards,

    userausera




    :)
     
    userausera, Jul 14, 2020
    #1
  2. tcebob Win User

    Can't run command in PowerShell but OK in Cmd

    I tried the suggested command and it does work manually in Power Shell. But Task Scheduler chokes on it.


    Powershell with CMD/c to run external command with Parameters [​IMG]


    If i say "Yes" it breaks up the command string to "%C:\program" with the rest of the command as an argument.
     
    tcebob, Jul 14, 2020
    #2
  3. ryanly Win User
    GPU-Z what command line parameter ?

    Current /? (-?) or / help (-help) parameter is invalid
     
    ryanly, Jul 14, 2020
    #3
  4. dalchina Win User

    Powershell with CMD/c to run external command with Parameters

    dalchina, Jul 14, 2020
    #4
Thema:

Powershell with CMD/c to run external command with Parameters

Loading...
  1. Powershell with CMD/c to run external command with Parameters - Similar Threads - Powershell CMD run

  2. CMD command doesn't work on PowerShell

    in Windows 10 Gaming
    CMD command doesn't work on PowerShell: I'm trying to call 'cmd' inside Windows PowerShell console in order to get to work immediately with Command Prompt mode, but I got this message instead:I know I can use Command Prompt outside of PowerShell, but this is a special case.Any suggestions about how can I revert...
  3. CMD command doesn't work on PowerShell

    in Windows 10 Software and Apps
    CMD command doesn't work on PowerShell: I'm trying to call 'cmd' inside Windows PowerShell console in order to get to work immediately with Command Prompt mode, but I got this message instead:I know I can use Command Prompt outside of PowerShell, but this is a special case.Any suggestions about how can I revert...
  4. CMD command doesn't work on PowerShell

    in Windows 10 Customization
    CMD command doesn't work on PowerShell: I'm trying to call 'cmd' inside Windows PowerShell console in order to get to work immediately with Command Prompt mode, but I got this message instead:I know I can use Command Prompt outside of PowerShell, but this is a special case.Any suggestions about how can I revert...
  5. Can't run almost any commands in cmd/powershell

    in Windows 10 Gaming
    Can't run almost any commands in cmd/powershell: Basically, adb : The term 'adb' 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:1 + adb + ~~~ + CategoryInfo :...
  6. Can't run almost any commands in cmd/powershell

    in Windows 10 Software and Apps
    Can't run almost any commands in cmd/powershell: Basically, adb : The term 'adb' 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:1 + adb + ~~~ + CategoryInfo :...
  7. Open Cmd via PowerShell, command?

    in Windows 10 BSOD Crashes and Debugging
    Open Cmd via PowerShell, command?: Please i need to open cmd win + r and so i know i need to know how to open it via powershell pls (.bat and so i know it needs to be opened via powershell. Pls PowerShell command to open cmd? Cmd über PowerShell öffnen, Befehl?
  8. Cannot run linux command directly from cmd/powershell

    in Windows 10 BSOD Crashes and Debugging
    Cannot run linux command directly from cmd/powershell: Recently, I upgraded my windows to 2004 from 1909. I notice that I cannot run command like "xxx grep xx" from command line anymore. Initially I thought that is because I have WSL2 Ubuntu distro now, but converting Ubuntu to WSL1 didn't help the problem. On Win10 2004:...
  9. Can't run command in PowerShell but OK in Cmd

    in Windows 10 Support
    Can't run command in PowerShell but OK in Cmd: [img] [img] The screen shots show results of running Code: "C:\Program Files\AVAST Software\Avast\ashCmd.exe" /@=Quick[/quote] in both PS and Cmd. The problem is I have made a task in Task Scheduler to run this command daily and, apparently, Task Scheduler insists on...
  10. 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--