Windows 10: Execute command automatically directly at start of cmd?

Discus and support Execute command automatically directly at start of cmd? in Cortana to solve the problem; Is it possible that a command like "cd \... " so that I am directly in the selected directory after each startup? Befehl direkt bei Start von cmd... Discussion in 'Cortana' started by aNetworkUser, Aug 14, 2020.

  1. Execute command automatically directly at start of cmd?


    Is it possible that a command like "cd \... " so that I am directly in the selected directory after each startup?

    :)
     
    aNetworkUser, Aug 14, 2020
    #1
  2. ram93 Win User

    laptop doesnt boot automatically

    This is what happened.

    1. Did a repair install and later disabled hibertnate in CMD.
    2. Enabled legacy option ROM in BIOS.
    3. After a few times startup ( i used the system in such mode for 5 days), changed boot option back to default.
    4. Vola!! It boots automatically to win10 without any keypress. Tested it with many starts to confirm the same.
    5. Re-enabled hibernate option using CMD and later selected Fast Startup.
    6. System booted normally, without the need for any keypress.

    I do not know exactly whether such steps resolved the problem or what else happened, hence cannot suggest above steps.

    Many thanks to all members who helped to troubleshoot problems.
     
    ram93, Aug 14, 2020
    #2
  3. Steven L Win User
    Using PowerShell via MMC to execute admin level CMD commands

    I'm new to PowerShell. I want to do something like this on shutdown before turning off the computer. I plan to have Windows MMC/Local Group Policy Editor do it with a PowerShell script.

    Basically, after triggering the shutdown or reboot event it should:

    1. Open CMD as admin (and automatically select Yes at UAC?).
    2. Execute SOME COMMAND (there will be many).
    3. Close CMD and then allow Windows 10 to shutdown/reboot.

    Now, I know how to get MMC to add a PowerShell script to execute before the shutdown command is completed. I just need to know the syntax on how to do the above three steps.

    To be clear though:

    My main point is to be able to open CMD as admin, type in a command and then exit CMD. PowerShell does not normally execute a few particular commands as admin correctly, but CMD does. In that way, PowerShell itself does not need admin privileges, just the temporary run CMD.

    I dont' mind clicking YES on a UAC, when needed, because I figure if it comes down to it, I can probably just used sendkeys {TAB}{TAB}{ENTER} or something. What I can't seem to find on the interwebs is how to start a PowerShell script so that one can save it. I'm seeing a lot on sendkeys in syntax though. In bash in Linux, it's simple: #!/bin/bash and presto insta-bash, but Windows seems bass-ackwards in this regard.

    If there is a better way to do this than, CMD > Echo "stuff" > exit CMD, please let me know. I know what stuff I want to type in each Echo "stuff" (or rather, sendkeys, if I end up using that), I just don't know how to open CMD as admin.

    Thanks.
     
    Steven L, Aug 14, 2020
    #3
  4. Execute command automatically directly at start of cmd?

    Vista Automatic Updating Error

    Automatic Updates isn't currently running.
     
    DistantDeath, Aug 14, 2020
    #4
Thema:

Execute command automatically directly at start of cmd?

Loading...
  1. Execute command automatically directly at start of cmd? - Similar Threads - Execute command automatically

  2. Why wont the cmd prompt start this command?

    in Windows 10 Gaming
    Why wont the cmd prompt start this command?: So I am in the process of fixing my computer by repairing Windows 10 using SFC with the offline option but whenever I try to run "sfc /scannow /oofbootdir=e:\ /offwindir=C: \Windows" it doesn't work instead it gives me a list of commands that sfc can be used with as seen...
  3. we want to execute cmd command through ssh in c#

    in Windows 10 Gaming
    we want to execute cmd command through ssh in c#: We are trying to execute some cmd command through ssh in c#.How can we proceed? https://answers.microsoft.com/en-us/windows/forum/all/we-want-to-execute-cmd-command-through-ssh-in-c/e9e1d788-c7e0-43ef-b44d-6a4422b2a570
  4. we want to execute cmd command through ssh in c#

    in Windows 10 Software and Apps
    we want to execute cmd command through ssh in c#: We are trying to execute some cmd command through ssh in c#.How can we proceed? https://answers.microsoft.com/en-us/windows/forum/all/we-want-to-execute-cmd-command-through-ssh-in-c/e9e1d788-c7e0-43ef-b44d-6a4422b2a570
  5. Most windows executable commands not recognized by CMD and PowerShell.

    in Windows 10 Gaming
    Most windows executable commands not recognized by CMD and PowerShell.: Out of nowhere commands which involve executables like explorer.exe, msedge.exe, mspaint.exe, where, etc. are not working in command prompt or PowerShell. The output of the command prompt seem to be quite simple: ```C:\Users\grass>where 'where' is not recognized as an...
  6. Most windows executable commands not recognized by CMD and PowerShell.

    in Windows 10 Software and Apps
    Most windows executable commands not recognized by CMD and PowerShell.: Out of nowhere commands which involve executables like explorer.exe, msedge.exe, mspaint.exe, where, etc. are not working in command prompt or PowerShell. The output of the command prompt seem to be quite simple: ```C:\Users\grass>where 'where' is not recognized as an...
  7. Command can't be executed directly from the Windows 10 search box.

    in Cortana
    Command can't be executed directly from the Windows 10 search box.: Windows 10 1909 18363.815, keeping the latest update. All hardware is up to date. I used to run some short commands directly from the search box. For instance, if I type in "ping 8.8.8.8" in the search box and then press enter, a command line window will pop up and run the...
  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. 10 CMD commands that can be executed with PowerShell

    in Windows 10 News
    10 CMD commands that can be executed with PowerShell: [ATTACH] PowerShell is Microsoft’s own alternative to their own Command Prompt. Earlier, Microsoft announced that they will be open sourcing PowerShell and will be bringing it to recent versions and different Linux flavors like Ubuntu, CentOS, Red Hat Enterprise Linux,...
  10. How do i run cmd with commands already executed!

    in Windows 10 Support
    How do i run cmd with commands already executed!: OK say I wanted to run a cmd (I know I will have to use notepad so im pretty much asking the command and ending of the command ex. CMD.bat) For those that want to go ahead and be really helpful im looking to open cmd and do "color 4" Simple 99681