Page 1 of 1

Syntax error

Posted: 31 Jan 2019 00:03
by Docfxit
I'm getting this error:
( was unexpected at this time.

Code: Select all

set "_WinVer=Windows 10"
Just before this code:

Code: Select all

If "%_WinVer%==Windows 10" (
bcdedit.exe /create /d "Windows 10" /application osloader >"%~dp0BootFixerGUID.txt"
)
pause
Else
::Now we have a clean, working Win 7 bootloader. But we need to add a Win 7 entry to it:
If "%_WinVer% = Win7  or server 2008 R2" (
bcdedit.exe /create /d "Windows 7" /application osloader >"%~dp0BootFixerGUID.txt"
)
Please help me fix this,

Docfxit

Re: Syntax error

Posted: 31 Jan 2019 01:14
by miskox
Try with this:

change

Code: Select all

If "%_WinVer%==Windows 10" (
to

Code: Select all

If "%_WinVer%"=="Windows 10" (
Correct everywhere.

Saso

Re: Syntax error

Posted: 31 Jan 2019 07:44
by Squashman
You have two other code problems as well.

The proper syntax for using IF ELSE is clearly defined in the help file for the IF command. Your code is not even remotely close.

Code: Select all

IF "something"=="something" (
	echo do this
) ELSE (
	echo do that
)
Also there is no OR operator defined in the help file for the IF command. You need to chain together multiple IF command to essentially do an OR.

Re: Syntax error

Posted: 31 Jan 2019 07:53
by pieh-ejdsch
Hello Docfxit,

Just call the right place in the script.
Then the many comparisons are omitted.

Code: Select all

@echo off
setlocal

for /f "eol=Ctokens=2-6delims=cropfestivnawld®. " %%a in ('"WMIC os get caption"') do call :%%a%%b%%c%%d%%e
if errorlevel 1 echo NOT used ...

pause
exit /b

:WRT81-
echo %0
exit /b 0  

:W7P
:W7E
echo %0

 rem do it at seven
exit /b 0

:W10P
echo %0
exit /b

:WS2008S
echo %0
exit /b 0 
 
:WS2008R2S
:WS2008R2E
echo %0
 rem do it at Server R2

exit /b 0

REM Ausgaben der Abfrage bei den unterschiedlichen Betriebsystemen:
 REM Microsoft Windows 7 Professional
 REM Microsoft Windows 7 Enterprise
 REM Microsoft® Windows Server® 2008 Standard
 REM Microsoft Windows Server 2008 R2 Standard
 REM Microsoft Windows Server 2008 R2 Enterprise
 REM Microsoft Windows XP Professional
 REM Microsoft Windows 10 Pro
Phil