vendredi 31 mai 2019

How can I fix this batch file so that it does not error out on the IF statement?

I am pulling my hair out getting an error on this IF statement

IF %resultis%=="true" (

The batch file hits the pause right before it but right after that gets some error that goes by to fast for me to see what it is.

Here is the full script:

@Echo off
Echo "Adding Chrysaliser user to Users group and removing from Administrators"
REM net localgroup Users Chrysaliser /add
REM net localgroup Administrators Chrysaliser /delete

REM SET /P password= Enter ladmin user password: 
REM net user ladmin %password% /ADD
REM net localgroup Administrators ladmin /add

SET /P alaptop= Is this a laptop? (Y/N): 
echo %alaptop%
IF %alaptop%=="Y" (SET resultis="true")
IF %alaptop%=="y" (SET resultis="true")
pause
IF %resultis%=="true" (
    pause   
    SET /P password= Enter Lockedout user password: 
    pause
    net user Lockedout %password% /ADD
    net localgroup Users Lockedout /add
    net localgroup Administrators Chrysaliser /delete

)
Echo Getting install files
mkdir %SYSTEMDRIVE%\files
SET /P username= Enter your domain admin username: 
SET/P password= Enter your domain admin password:
net use \\server /user:%username% $password%
pause

Aucun commentaire:

Enregistrer un commentaire