mercredi 10 novembre 2021

My code isn't keeping the terminal opened

I'm working on a batch script that deletes files when given the file name. I cant get it to run and keep the terminal opened. I've had this issue before, but I fixed it after several changes, which aren't applicable in this situation. I'm not sure if its my code or if its something I don't know of. I will put all my code below, its only about 12 lines. Some help would be greatly appreciated, any tips for improving my code, suggestions for optimizing my code, or something else like that would be greatly appreciated. Thank you in advance for the help.


My Code

@echo off
goto runFirst
:runFirst

    set /p choice=="What app would you like to delete? (include the extention)"
        for /f "delims=" %%F in ('dir /b /s "C:\%choice%" 2^>nul') set MyVariable=%%F
    if defined p (
        echo %MyVariable%
    ) else (
        echo File not found
    )
    pause
exit

Aucun commentaire:

Enregistrer un commentaire