Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Run CMD Commands in Batch Files  (Read 45304 times)

0 Members and 1 Guest are viewing this topic.

Teroro

    Topic Starter


    Greenhorn

    • Experience: Beginner
    • OS: Unknown
    Run CMD Commands in Batch Files
    « on: October 28, 2021, 02:43:23 PM »
    How do I run multiple cmd commands in a batch file?

    I tried this and it works
    Code: [Select]
    cmd /k "cd C:\Users\TE IUBESC!!!MAMI\OneDrive\Desktop\Sheesh"But after that the program stops doing anything.
    How can I add more commands after that?
    Like run this command right after the previous command then close the window?

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Run CMD Commands in Batch Files
    « Reply #1 on: October 28, 2021, 02:52:05 PM »
    There is no need to use CMD /K
    Code: [Select]
    cd /D "C:\Users\TE IUBESC!!!MAMI\OneDrive\Desktop\Sheesh"
    echo I am in this folder: %cd%
    echo Let's start notepad
    start "" "notepad.exe"

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Run CMD Commands in Batch Files
    « Reply #2 on: October 28, 2021, 09:07:20 PM »
    This may help.
    https://ss64.com/nt/cmd.html
    Quote
    /K     Run Command and then return to the CMD prompt.
              This is useful for testing, to examine variables
    ;D