You were already given the proper syntax for this process in your last thread. DO NOT DUPLICATE YOUR QUESTIONS!
I am merging your topics together!!!!!!!
Script only by computer name...
Moderator: DosItHelp
Re: Script only by computer name...
Getting:
The syntax of the command is incorrect
What I'm doing wrong?
The syntax of the command is incorrect
What I'm doing wrong?
Code: Select all
IF /I "%COMPUTERNAME:~0,3%"=="PCM" (
\\test\bginfo.exe \\test\pcmDesktop.bgi /timer:0 /silent /accepteula
) ELSE IF /i "%computername:~0,3%"=="PCS" (
\\arkiants\it$\test\bginfo.exe \\arkiants\it$\test\pcsdesktop.bgi /timer:0 /silent /accepteula
) ELSE IF /i "%computername:~0,2%"=="PC"(
\\test\bginfo.exe \\test\pcdesktop.bgi /timer:0 /silent /accepteula
)
Re: Script only by computer name...
You are missing a space before the last left parentheses.
Re: Script only by computer name...
I'd also quote your paths considering some contain special characters...
Re: Script only by computer name...
Code: Select all
@echo off
IF /I %COMPUTERNAME:~0,6%=="mokedm"
then
(\\test\bginfo.exe \\arkiants\it$\test\4.bgi /timer:0 /silent /accepteula)
ELSE IF /i %computername:~0,5%%== "moked"
then
(\\test\bginfo.exe \\arkiants\it$\test\3.bgi /timer:0 /silent /accepteula)
ELSE IF /i %computername:~0,3%%== "sdv"
then
(\\test\bginfo.exe \\arkiants\it$\test\2.bgi /timer:0 /silent /accepteula)
moked01
mokedm02
sdv01
Not working why?
GETTING THIS:
The syntax of the command is incorrect
Thanks,
Re: Script only by computer name...
The first if-command in your file is the following:
The syntax of the above if-command is as follows:
So the processor sees:
- processing: "if"-command
- using option "/i": true
- <String1>: %COMPUTERNAME:~0,6%
- <CompareOp>: ==
- <String2>: "mokedm"
- <Command> is not present => Syntax error
penpen
Code: Select all
IF /I %COMPUTERNAME:~0,6%=="mokedm"
Code: Select all
if [/i] <String1> <CompareOp> <String2> <Command>
- processing: "if"-command
- using option "/i": true
- <String1>: %COMPUTERNAME:~0,6%
- <CompareOp>: ==
- <String2>: "mokedm"
- <Command> is not present => Syntax error
penpen
Re: Script only by computer name...
Locking this thread until I get a reply from user.