vendredi 3 décembre 2021

I am having issues with if-statements in Batch File [duplicate]

I am working on a script in batch for deleting files from all directories on my computer. I have the basics laid out, but I've run into an issue I have yet to encounter while working on Batch File code. I will put my code below, but what is happening is that when I run the code I cant make it past the first if-statement, I inserted pauses after each line so I could find out where the problem is and that's how I know this. What happens when I run the code is that it runs properly, It opens a terminal window, and it prompts the user for input, but immediately after I give the input something with the if-statement kills it. I've have done plenty of if-statements before in Batch File, but this is the first time I've ever encountered an error like this, some help would be greatly appreciated. Thanks in advance for all the help!

The Code


echo ~~~~~~~~~~~~~~
echo Program Delete
echo ~~~~~~~~~~~~~~
set /p choice=Please enter 1 to continue or 0 to return to menu: 
if %choice%==1 (
    pause
    Set /P inp=Please enter a file name: 
    pause
    for /f %%F in (C:\Program Files)(
        if "%%F" == "%inp%" (
        goto:remo
    )
)

(I haven't finished the code entirely yet, I'm just making sure the parts that I have made run properly.)

Aucun commentaire:

Enregistrer un commentaire