Share via

What is %..% sign means in CMD batch files?

Anonymous
2022-02-18T05:49:03+00:00

What is %..% sign means in CMD batch files?

Ex:

@echo off

set /p var="Enter no.: "

set /p var2="Enter no.: "

set /a result=%var%+%var2%

echo Your result is %result%

pause

exit /b

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2022-02-18T06:28:25+00:00

    Hi Sachin007,

    I am Bhavik, a Microsoft user like you. Please note, I am not a Microsoft employee and don’t have direct access to your account, but I will do everything I can to help you with your queries. :)

    In a Batch file, any variable you use needs to be enclosed in %%. Otherwise, Batch File will not know that it has to refer to this as a variable or plain text.

    In your example, 'var' and 'var2' are two variables that receive values from user input and the 'result' is the third variable that stores the sum of 'var' and 'var2'.

    To know more, refer to this webpage:

    https://www.tutorialspoint.com/batch_script/bat...

    Let me know in case of any further assistance is required, I will be glad to assist.


    Disclaimer:

    This reply contains non-Microsoft websites. The page(s) appear to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.

    Thanks

    Bhavik

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2022-02-19T04:19:03+00:00

    Thank you

    0 comments No comments
  2. Anonymous
    2022-02-19T04:18:50+00:00

    Thank you

    0 comments No comments