Missinng Operand For Loop Batch

时间:2017-10-03 07:14:39

标签: batch-file

下面是一段“应该”用于ping我的网络上的所有IP并将计算机名称返回到桌面上的.txt文件的代码。每次运行它都会给我“丢失操作数”错误。任何帮助都会很好,格拉西亚斯!

    @Echo Off
Title Getting all Computer Names from Network. . .
Color A
SETLOCAL EnableDelayedExpansion

REM Convert Current IPv4 Address to Variable.
For /F "skip=1 delims={}, " %%A in ('wmic nicconfig get ipaddress') do For /F "tokens=1" %%B in ("%%~A") do set "IP=%%~B"
SET "offsets=0.0.0.0"

For /F "tokens=1-4 delims=. " %%A in ("%IP%") do (
   For /F "tokens=1-4 delims=." %%I in ("%offsets%") do (
      set /A octetA=%%A+%%I, octetB=%%b+%%j, octetC=%%c+%%k, octetD=%%d+%%l
   )
) 

REM Do a Ping Sweep To Get Computer Name.
For /L %%B in (1,1,254) do For /F "Tokens=2 Delims== " %%A in ('wmic /node:"%octetA%.!octetB!.!octetC!.%%B" computersystem get name /value') do set "Host=%%A"

REM Output Computer Name In Text File
Echo %Host% >> "C:\Users\%username%\Desktop\ComputerNames.txt"


pause

1 个答案:

答案 0 :(得分:3)

metavariables

set /A octetA=%%A+%%I, octetB=%%B+%%J, octetC=%%C+%%K, octetD=%%C+%%L 区分大小写。

@Entity
@Table(name = "drivers")

public class Driver implements Serializable {
    private  Integer id;
    private String name;
    private Integer age;
    private String address;
    private String location;


@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

@Column(name = "name")
public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

   @Column(name = "age")
    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

  @Column(name = "address")
    public String getAddress() {
        return address;
    }


    public void setAddress(String address) {
        this.address = address;
    }

@Column(name = "location")
    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }




public Driver() {
}

public Driver(String name, Integer age, String address , String location ) {
    this.name = name;
    this.age = age;
    this.address = address;
    this.location = location;
}
}