cmd /k command

Page 1 of 2 12 LastLast

  1. Posts : 10
    windows 10
       #1

    cmd /k command


    Windows 10:
    When I start a shortcut to a .exe file with cmd /c, a black command window pops up for about 2 seconds, then it disappears and the .exe program runs. How can I prevent to black command window to pop up and directly run the .exe program?
      My Computer


  2. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #2

    Hello hukre and welcome to TF ,

    Title says /k body say /c - details of exactly what your are doing would be useful. What does your shortcut look like? Why not just a shortcut to the exe without cmd?

    This may be useful: https://www.makeuseof.com/run-comman...ktop-shortcut/
      My Computer


  3. Posts : 10
    windows 10
    Thread Starter
       #3

    I apologize for the error in my headline; it should have said "cmd /c command"
      My Computer


  4. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #4

    hukre said:
    I apologize for the error in my headline; it should have said "cmd /c command"
    No worries Still would like some specific details/example of what you're trying to do to further help you.
      My Computer


  5. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #5

    Let's say I have an app and I want to run it by a shortcut that I create.

    I just right-click on the app .exe, select the option to create a shortcut, then I can click on that shortcut to run the app. Have you tried that?
      My Computer


  6. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #6
      My Computer


  7. Posts : 13,896
    Win10 Version 22H2 Pro and Home, Win11 Pro and Home
       #7

    And the context menu on right-click of an executable file may show Send to (Desktop, create shortcut). That shortcut usually can be stored later in a different location, also choices of Pin to Start or Pin to Taskbar.
      My Computers


  8. Posts : 10
    windows 10
    Thread Starter
       #8

    Dear Steve 108'
    I very much appreciate your assistance in getting my problem resolved.

    I planned to run a batch file from a shortcut so I placed a shortcut on the desktop, and
    when I double click on it, the batchfile runs ok.

    Now I want to put the shortcut on the Taskbar. This is where my problem started. After right-clicking on the
    icon, the small window which comes up does not include the choice "Pin to taskbar" as it does when you
    right-click on some of the other shortcuts on the desktop; dragging it onto the taskbar is not accepted.

    After looking into this, I found that in order to get it on the taskbar, you have to precede the shortcut target
    with cmd /c, to make the target look like: cmd /c "C:\users\batchfiles\testing.bat".
    Now when you right click on the desktop icon again, the choice of "Pin to taskbar" is restored.

    I since discovered that when you run a batchfile from the shortcut, the black cmd screen pops up but
    disappears in less than a second.

    When I first noted the problem described in my original question, I used the cmd /c command on a .exe file,
    where the black command screen stayed on for about 2 seconds. In the mean time, it turns out that the
    cmd /c command was not needed in the shortcut for the .exe file.
      My Computer


  9. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #9

    You might also try creating a shortcut to the batch file and dragging it into the taskbar to pin it - that's a quick way.

    So unclear to me if your issue is now sorted or not.
    Last edited by steve108; 23 Oct 2021 at 15:04.
      My Computer


  10. Posts : 10
    windows 10
    Thread Starter
       #10

    I tried dragging the shortcut for the batch file to the taskbar but it shows a red NO-NO icon and it won't stay on the taskbar.
    Other than that, the issue seems to be resolved; thank you very much for your time and effort,
    Hukre
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:49.
Find Us




Windows 10 Forums