I wrote this is out of boredom but I need a little help with it. The below code is the whole but I will break it up into smaller chunks as option 2 is a pain.
@echo off
Set SQMFile="C$\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM"
Set CSVFile="%userprofile\Documents"
:top
cls
echo.
echo You upgraded to IE 11 and now you can't login
echo follow the prompts below and I will fix it
echo for you :)
echo.
echo.
echo 1) Single Computer?
echo 2) Multiple Computers? (txt file)
echo 3) Help menu
echo.
echo.
Set /p C="What do you want to do? "
if %C%==1 goto opt1
if %C%==2 goto opt2
if /i %C%==3 goto help
::===================================================================
:opt1
Set /p comname="Whats the computer name? "
if exist "\\%comname%\%SQMFile\iesqmdata_setup0.sqm" (
echo File is there...
echo Deleting File
del "\\%comname%\%SQMFile\iesqmdata_setup0.sqm"
goto top
) else (
echo File is not there
goto top
)
::===================================================================
:opt2
Set /p opt2="Is the file in your Documents folder named Computers.txt? (Y/N) "
if /i %opt2%==y goto file
if /i %opt2%==n goto loc
::===================================================================
:loc
cls
echo Where's the file located and what's it called?
echo example "C:\users\<username>\documents\list of comptures.txt"
set /p newloc="No need for quotes: "
echo In File label
pause
for /F %%G in ("%newloc%") DO (
if exist "\\%%G\%SQMFile\iesqmdata_setup0.sqm" (
echo File is there
pause
::del "\\%%G\%SQMFile\iesqmdata_setup0.sqm"
) else (
echo File is not there
)
)
Pause
goto top
::===================================================================
:file
echo In File label
pause
for /F %%G in ("%CSVFile%\Computers.txt") DO (
if exist "\\%%G\%SQMFile\iesqmdata_setup0.sqm" (
echo File is there
::del "\\%%G\%SQMFile\iesqmdata_setup0.sqm"
) else (
echo File is not there
)
)
Pause
goto top
::===================================================================
:help
cls
echo.
echo.
echo =================Help Menu===========================
echo This script is used only for deleting the .sqm
echo file that likes to break the "User Logon Service"
echo for computers after updating to IE 11
echo.
echo Option 1 is for single computers.
echo It checks for the file and if there it
echo deletes it.
echo.
echo Option 2 does the same as 1 but is more geared towards
echo mass amounts of computers. a multi line, single entry
echo file is supported ex:Line1
echo Line2
echo Line3
echo Please save the file in %userprofile%\Documents
echo with the file name Computers.txt
echo =====================================================
echo.
echo.
Pause
goto top
:eof
So as I said above Option 2 gives me ") was unexpected at this time"
for both Yes and No.
:loc
works until the For /F
and thats where is decides to fail and throw the error. But what I am trying to do is read the file of names and check if the file is there delete it. If not then loop to next.
block in question:
:opt2
Set /p opt2="Is the file in your Documents folder named Computers.txt? (Y/N) "
if /i %opt2%==y goto file
if /i %opt2%==n goto loc
::===================================================================
:loc
cls
echo Where's the file located and what's it called?
echo example "C:\users\<username>\documents\list of comptures.txt"
set /p newloc="No need for quotes: "
echo In File label
pause
for /F %%G in ("%newloc%") DO (
if exist "\\%%G\%SQMFile\iesqmdata_setup0.sqm" (
echo File is there
pause
::del "\\%%G\%SQMFile\iesqmdata_setup0.sqm"
) else (
echo File is not there
)
)
Pause
goto top
::===================================================================
:file
echo In File label
pause
for /F %%G in ("%CSVFile%\Computers.txt") DO (
if exist "\\%%G\%SQMFile\iesqmdata_setup0.sqm" (
echo File is there
::del "\\%%G\%SQMFile\iesqmdata_setup0.sqm"
) else (
echo File is not there
)
)
Pause
goto top
Aucun commentaire:
Enregistrer un commentaire