Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Docfxit
- Posts: 132
- Joined: 12 Nov 2015 12:42
#1
Post
by Docfxit » 31 Jan 2019 00:03
I'm getting this error:
( was unexpected at this time.
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
-
miskox
- Posts: 630
- Joined: 28 Jun 2010 03:46
#2
Post
by miskox » 31 Jan 2019 01:14
Try with this:
change
to
Correct everywhere.
Saso
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#3
Post
by Squashman » 31 Jan 2019 07:44
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.
-
pieh-ejdsch
- Posts: 240
- Joined: 04 Mar 2014 11:14
- Location: germany
#4
Post
by pieh-ejdsch » 31 Jan 2019 07:53
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