Windows 10: need to run a cmd command as administrator within batch file

Discus and support need to run a cmd command as administrator within batch file in Windows 10 Customization to solve the problem; Hey, Probable pretty easy for some of you but after a bit of googling I can't quite figure it out. I need to run a command within CMD as... Discussion in 'Windows 10 Customization' started by DanTov, Jul 16, 2018.

  1. DanTov Win User

    need to run a cmd command as administrator within batch file


    Hey,


    Probable pretty easy for some of you but after a bit of googling I can't quite figure it out.


    I need to run a command within CMD as administrator within a batch file which then users can just run.


    Any ideas would be great.


    Dan

    :)
     
    DanTov, Jul 16, 2018
    #1
  2. Kotabug Win User

    My Batch File(.bat) is no longer running CMD

    My Batch File(.bat) is no longer running CMD and when i go and change the program and find CMD and or Command Prompt it says that the program that i chose cannot be associated with this file type. Please choose another. I ran CMD with .bat file before, but
    now i can't. I there a solution to this, please?

    Original Title: Set Associations
     
    Kotabug, Jul 16, 2018
    #2
  3. MarkSB61 Win User
    CMD commands not working in windows 10

    I have Batch files which I use to backup new data from my PC to USB and External drive, as well as External Drive to my laptop. These have been working fine for some years now.

    However my Win10 laptop currently does not recognise any CMD prompts; all Administrator run commands end up with the following:

    "{command eg XCOPY, RUN, IPCONFIG etc.} is not recognized as an internal or external command,operable program or batch file."

    Duplicating the process by double clicking the batch file from either the laptop or the same one on the external Hard drive, opens the CMD window, quickly scrolls through the commands and then closes

    But on inspection, no commands at all have succeeded.

    The very same batch files (with different drive letters) still work fine between my PC, External Drive and USB.

    Please advise.
     
    MarkSB61, Jul 16, 2018
    #3
  4. need to run a cmd command as administrator within batch file

    Start a program from a batch file


    Many thanks!

    However your suggested command only works when I run it manually from the command line. Having it in a .cmd file double-clicking the .cmd file only executes the first line enabling the game controllers. I also tried creating a shortcut to the .cmd file and tick the 'Run as Administrator' option but still no go and same thing when right-clicking the .cmd file choosing 'Run as Administrator'.

    So...for whatever reason the command you suggested works perfectly fine when you run it manually from the command line but not when it's included in a .cmd file.

    Then there's the other question/problem how to make the .cmd file wait to execute the third line (disabling my game controllers) until Prepar3D.exe has quit.
     
    WebMaximus, Jul 16, 2018
    #4
Thema:

need to run a cmd command as administrator within batch file

Loading...
  1. need to run a cmd command as administrator within batch file - Similar Threads - need run cmd

  2. Having the output from a command within a batch file in a different color

    in Windows 10 Gaming
    Having the output from a command within a batch file in a different color: Hello. I am preparing to run the following script on one of our servers: REM Launch the batch files listed below to start the Exceed X environment, REM and log into the mcrs3 server using the putty application. REM List the hostname of the server that is being connected to by...
  3. Having the output from a command within a batch file in a different color

    in Windows 10 Software and Apps
    Having the output from a command within a batch file in a different color: Hello. I am preparing to run the following script on one of our servers: REM Launch the batch files listed below to start the Exceed X environment, REM and log into the mcrs3 server using the putty application. REM List the hostname of the server that is being connected to by...
  4. Batch File Command???

    in Windows 10 Gaming
    Batch File Command???: I want to run a batch file that starts a backup program, but does not execute the next command until that program completes? How do I do this? https://answers.microsoft.com/en-us/windows/forum/all/batch-file-command/3af2ce6b-ace3-43cb-b6fb-5cbff8998736
  5. Batch File Command???

    in Windows 10 Software and Apps
    Batch File Command???: I want to run a batch file that starts a backup program, but does not execute the next command until that program completes? How do I do this? https://answers.microsoft.com/en-us/windows/forum/all/batch-file-command/3af2ce6b-ace3-43cb-b6fb-5cbff8998736
  6. Starting batch file only opens command prompt versus running the batch file?

    in Windows 10 Gaming
    Starting batch file only opens command prompt versus running the batch file?: I'm trying to run one batch file, then another. Instead of running the 2nd batch file, it just opens another black screened command prompt with the name of the batch file as the first line in the command prompt? Any ideas why?...
  7. Starting batch file only opens command prompt versus running the batch file?

    in Windows 10 Software and Apps
    Starting batch file only opens command prompt versus running the batch file?: I'm trying to run one batch file, then another. Instead of running the 2nd batch file, it just opens another black screened command prompt with the name of the batch file as the first line in the command prompt? Any ideas why?...
  8. run a powershell command like a batch file

    in Windows 10 Installation and Upgrade
    run a powershell command like a batch file: I am working as a temp on a Windows 7 to Windows 10 migration team. We've encountered a problem with some software, and a solution has been found that requires us to execute a a single command with PowerShell. However, the command is extremely long and complex, and very...
  9. CMD Batch file help

    in Windows 10 Support
    CMD Batch file help: Hello, i am running into a issue i am trying to resolve but im getting nowhere and hopefully someone could help me. I'm simply trying to point a copy to parent or "grand"parent directory/folder. I tried ".." but it seems to come back the same message Code: The system cannot...
  10. Useful CMD commands (administrator)

    in Windows 10 BSOD Crashes and Debugging
    Useful CMD commands (administrator): Hello, Please send me all the CMD commands required for leptop and what role does CMD have in my order. I'm mentioning that on leptop I installed Windows 10 Home version 1809 Thank you! A wonderful day!...