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

  • Home
  • SEARCH
  • 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 8502781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:34:52+00:00 2026-06-11T01:34:52+00:00

Here is the code I wrote: @echo off :top set chkScheduleTime= set chkScheduleName= set

  • 0

Here is the code I wrote:

 @echo off
:top
set chkScheduleTime=""
set chkScheduleName=""


set /p scheduleName=Enter the name of the schedule?
cls
set /p scheduleTime=Enter the time to schedule task?
cls


set chkScheduleTime=%scheduleTime =%
set  chkScheduleName=%scheduleName =%

IF /I "%chkScheduleName%"=="" ( 
    set errorMessage=*Name of schedule required 
)


IF /I "%chkScheduleTime%"=="" (
    set errorMessage=%errorMessage% *Time of schedule required 
)

IF NOT defined "%errorMessage%" (

    echo %errorMessage%
    pause
    cls
    goto top
)




echo Schedule Name %scheduleName% 
echo.
echo Time: %scheduleTime%


:end

What I am trying to do is accept two parameters from the user which are the task schedule name and the time of the task. Then the program would check the the variables if they are empty and display an error for the variable that is empty, then prompt the user to re-enter the variable (if one or both were not entered). However the program is displaying the following even if the user entered the schedule name and time:

*Name of schedule required *Time of schedule required

Also note the following part of the code is used to help check if the values entered by the user are only spaces. Thus its the equivalent of Trim() in regular programming:

set chkScheduleTime=%scheduleTime =%
set  chkScheduleName=%scheduleName =%
  • 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-06-11T01:34:54+00:00Added an answer on June 11, 2026 at 1:34 am

    You need to use

    set chkScheduleTime=%scheduleTime: =%
    

    to strip the spaces from scheduleTime.

    Also you never reset errorMessage, so that once you have an error it won’t go away.

    Also I think you might want to use if defined errorMessage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is a small peice off code that i wrote. But I am not
I have a bit of code I wrote, that echo's 3 variable (quiz name,
Here is the code i wrote,when i execute the code,the terminal didn't output anything
i added sharekitkit my project. And wrote code like here : SHKItem *item =
So, here's the problem. I wrote a code that opens a div based on
so as the title says..... here is the code I currently wrote thinking it
Alright, here I am again trying to write code from scratch and I can't
I'm trying to write a video using opencv's VideoWriter. Here's code: int main() {
Here's my code: sentenceToTranslate = raw_input(Please write in the sentence you want to translate:
I was able to write some code with the help of the community here,

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.