How to create an infinite loop in Windows batch file?

前端 未结 6 2262
遥遥无期
遥遥无期 2020-11-28 02:50

This is basically what I want in a batch file. I want to be able to re-run \"Do Stuff\" whenever I press any key to go past the \"Pause\".

while(true){
            


        
6条回答
  •  天命终不由人
    2020-11-28 03:18

    Here is an example of using the loop:

    echo off
    cls
    
    :begin
    
    set /P M=Input text to encode md5, press ENTER to exit: 
    if %M%==%M1% goto end
    
    echo.|set /p ="%M%" | openssl md5
    
    set M1=%M%
    Goto begin
    

    This is the simple batch i use when i need to encrypt any message into md5 hash on Windows(openssl required), and the program would loyally repeat itself except given Ctrl+C or empty input.

提交回复
热议问题