Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6682261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:41:06+00:00 2026-05-26T04:41:06+00:00

Im making a .bat game, and currently when putting in a command the code

  • 0

Im making a .bat game, and currently when putting in a command the code is

set /p command=

What i want to know is if you can somehow have a time limit for inputting the commands. For example if your fighting a guard, and you haven’t put a command in for say 5 seconds, the guard attacks.

This is not something of dire need, I am just wondering more about the limitations im bound to, and i think i know the anawer anyway (the answer being that you cant)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:41:07+00:00Added an answer on May 26, 2026 at 4:41 am

    It can also be done with batch only.

    You can create a second thread (in the same window) with start /b.
    If this thread wait with set /p for user input, the main thread is not affected.
    This sample will wait for 5 seconds for userinput, if the user inputs text it is moved into a file, so the first thread can access it.

    @echo off
    setlocal EnableDelayedExpansion
    if "%1" NEQ "" goto %1
    
    del enter.tmp 2>nul >nul
    start /b cmd /c %0 :secondThread
    
    :FirstThread
    set n=0
    echo Enter Text (5 seconds timeout):
    
    :loop
    set /a n+=1
    ping -n 2 localhost > nul
    if !n! LSS 5 (
        if not exist entER.tmp goto :loop
        < Enter.tmp (
            set /p input=
        )
        echo !input!
    ) ELSE (
        echo Timeout for input
    )
    
    exit /b
    
    :secondThread
    set /p var=
    > enter.tmp echo !var!
    exit /b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an Android app using Processing, and have decided to port my code
Making game of life I need to a have a grid that is 30x20
I'm making a bat game, and for the location of the player im using
I'm making a text game written in bat, and the game has been done,
Making my first steps with NHibernate, I'm trying to have it creating my Tables
Making a new shooter game here in the vein of Galaga (my fav shooter
Making a flash page that can cycle through these three images on mouseclick. For
I'm making a site to document browser bugs where users can submit a bug
We have a fairly large code-base. The vast majority of the code is compiled
I am making a .bat file, and I would like it to write ASCII

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.