Windows 10: Variables changed in .bat files inside nested "if" statements do not their changed values...

Discus and support Variables changed in .bat files inside nested "if" statements do not their changed values... in Windows 10 BSOD Crashes and Debugging to solve the problem; When I run this: @Echo off set min=1 set max=12 echo database_connect_string > test2.scr1 set t3=connect_string echo. echo The 1st value for t3: %t3%... Discussion in 'Windows 10 BSOD Crashes and Debugging' started by RALane_1952, Aug 24, 2020.

  1. Variables changed in .bat files inside nested "if" statements do not their changed values...


    When I run this:


    @Echo off
    set min=1
    set max=12
    echo database_connect_string > test2.scr1
    set t3=connect_string
    echo.
    echo The 1st value for t3: %t3%
    set choice=3
    set envnum=2
    if %choice% geq %min%
    if %choice% leq %max%
    echo Now enter the nested "if" statements
    set t3=x
    echo the 2nd value for t3: %t3% It should be 'x' without the quotes
    set t3=user/pwd@connect_string/other
    echo the 3rd value for t3: %t3% This should be the content of isqlm.scr3:
    echo.
    type isqlm.scr3
    echo.
    echo the code would now start a sqlplus session using this connect string:
    echo %t3%, which is the value of t3, which is wrong
    echo.
    else
    echo.
    echo ERROR: Your choice has to be between %min% and %max%

    echo Now leave the nested "if" statements
    echo.
    echo The 4th and final value for t3 is: %t3%
    :end
    @Echo on


    This produces:


    The 1st value for t3: connect_string, which is correct.
    Now enter the nested "if" statements
    the 2nd value for t3: connect_string It should be 'x' without the quotes
    the 3rd value for t3: connect_string This should be the content of isqlm.scr3:

    user/pwd@connect_string/other

    the code would now start a sqlplus session using this connect string:
    connect_string, which is the value of t3, which is wrong

    Now leave the nested "if" statements

    The 4th and final value for t3 is: user/pwd@connect_string/other


    i.e., the changes in %t3% inside the nested "if" statements cannot be accessed/used within the nested "if" statements. But the final value set in the "if" statements can be used once you get out of them.

    :)
     
    RALane_1952, Aug 24, 2020
    #1

  2. How to change location of MSI????.tmp file

    Hi,

    You may change the location of the .tmp file by following the steps provided below:

    • Go to This PC.
    • Right-click This PC, and then select Advanced System Setting.
    • Click Environment Variables.
    • Under system variable, double-click tmp and change the path for the file of your reference.

    If the location still can't be changed, we suggest that you post it on our
    MSDN forum
    . We have highly technical users and IT professionals there that can address your concern.

    Feel free to contact us if you have other concerns.
     
    Dennis Mop, Aug 24, 2020
    #2
  3. I changes .exe (Default) files data value, and now I can't open .exe files. Can anyone tell me the normal data value for .exe?

    Hello Nilson,

    Thank you for posting in Microsoft Community.

    I understand that you have changed the values of .exe file extension and now you are unable to open any .exe files. We will help you.

    To assist you better, I suggest you to answer the below questions.

    • How did you change the values of the .exe file extensions?
    • What was the issue to change the values for .exe?
    • Is the PC used for testing purpose or you have you changed the values for any developing purpose?
    Please post to us with more information to help you better.
     
    Sachin Venkatesh, Aug 24, 2020
    #3
  4. zhisheng Win User

    Variables changed in .bat files inside nested "if" statements do not their changed values...

    Why can't normal privilege use a nested system environment variable

    Consider the following values for the following system environment
    variables:

    1test=%2test%

    2test=c:

    The nested not in alphabetical order.

    in normal privilege CommandLine %1test% is null ,but in administrators privilege CommandLine %1test% is c:

    it's a bug or how can i do?
     
    zhisheng, Aug 24, 2020
    #4
Thema:

Variables changed in .bat files inside nested "if" statements do not their changed values...

Loading...
  1. Variables changed in .bat files inside nested "if" statements do not their changed values... - Similar Threads - Variables changed bat

  2. Changes of PATH Variable

    in Windows 10 Gaming
    Changes of PATH Variable: Hello there,I changed the PATH Variable and added another directory to implement the given commands under DOS.The strange thing is, that this works fine as Administrator and absolutely not, when logged in with a non-administrator account.What do I do wrong?Kind regards...
  3. Changes of PATH Variable

    in Windows 10 Software and Apps
    Changes of PATH Variable: Hello there,I changed the PATH Variable and added another directory to implement the given commands under DOS.The strange thing is, that this works fine as Administrator and absolutely not, when logged in with a non-administrator account.What do I do wrong?Kind regards...
  4. Need to change file to .bat

    in Windows 10 Gaming
    Need to change file to .bat: I made a new text document and named it run.bat but it didn't change to a .bat file. https://answers.microsoft.com/en-us/windows/forum/all/need-to-change-file-to-bat/a303183b-1c61-48e0-84d1-be33a6fb2374
  5. Need to change file to .bat

    in Windows 10 Software and Apps
    Need to change file to .bat: I made a new text document and named it run.bat but it didn't change to a .bat file. https://answers.microsoft.com/en-us/windows/forum/all/need-to-change-file-to-bat/a303183b-1c61-48e0-84d1-be33a6fb2374
  6. BAT file to change some display settings?

    in Windows 10 Ask Insider
    BAT file to change some display settings?: I have an interesting situation where I use Parsec a bunch, but to do so I have to disable HDR and change the resolution of my monitor, as well as disabling all but my main. I was wondering if there is there a bunch of commands I can smash into a BAT file to changes these...
  7. Change Permissions for Hundreds of Nested Files

    in AntiVirus, Firewalls and System Security
    Change Permissions for Hundreds of Nested Files: I've recently recovered a backup. Hundreds if not thousands of files in a nested directory structure are denying access. Is there a way to grant access to the entire directory structure rather than one file at a time?...
  8. .bat files changed?

    in Windows 10 Ask Insider
    .bat files changed?: Greetings. Regarding Windows 10. I have a .bat file that I've used for... well, since forever. It rarely changes and it hasn't changed in months. Despite running quite fine in its current incarnation for some months now it's quite recently it's began throwing the error:...
  9. Use the value of Task Sequence Variable as the value of another Task Sequence Variable

    in Windows 10 Installation and Upgrade
    Use the value of Task Sequence Variable as the value of another Task Sequence Variable: Hi everybody, Does anybody know whether it is possible to use the value of an Task Sequence Variable as the value of another Task Sequence Variable? For example, TS variable A has the value of 8. And I want to use this as the value of variable Q. What I did was Set Task...
  10. Bat File to change notepad text

    in Windows 10 Support
    Bat File to change notepad text: Hi, I've been trying to make a batch file to change a line fo text in a .txt file, to the .bat files current directory. for example running it would produce this result: Run .Bat line of text in file changes to the current directory of .bat Anyone know any help with...