Solaris10与EMC-CX3-10c实现FC-SAN实施手册V2_第1页
Solaris10与EMC-CX3-10c实现FC-SAN实施手册V2_第2页
Solaris10与EMC-CX3-10c实现FC-SAN实施手册V2_第3页
Solaris10与EMC-CX3-10c实现FC-SAN实施手册V2_第4页
Solaris10与EMC-CX3-10c实现FC-SAN实施手册V2_第5页
已阅读5页,还剩37页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 Solaris 10与EMC CX3-10c实现FC-SAN实施手册现场背景:服务器3台,2台Sun Fire V490,1台Sun Fire V250。存储为DELL|EMC CX3-10c,配备8TB硬盘,一台Brocade SW200E光纤交换机。目的:实现FC-SAN构架。拓扑图:实施步骤:先完成Dell|EMC CX3-10c初始化,配置两个管理IP,分别为:XX.XX.XX.XX。建立服务器、光纤交换机、存储之间的链路。初始化光纤交换机,配置管理地址:XX.XX.XX.XX在Navisphere Manager管理界面发现链路。在服务器端安装Navisphere agent注册,

2、安装PowerPath多链路管理软件。具体安装操作如下:Navisphere agent的安装与配置先将光盘mount上后,再执行下面的命令:pkgadd -d NAVIAGNT.pkg会出现下述提示信息,按照提示信息选择安装即可。Select the packages that you want to install by doing one of thefollowing:? Enter 1 (to install the host agent)or? Enter 2 (to install CLI) or Enter All (to install both the host agent

3、and CLI)Enter y and y to begin the installation.The installation program looks for any agent configuration filesyou may already have on your system. If the program doesnot find any agent configuration files, then you have finishedinstalling the agent; go to step 10q. If the program does find anyexis

4、ting configuration files, it displays a message like the following:At Least 1 saved config file exists for NavisphereAgent.Please select 1 of the following:1Restore/etc/Navisphere/.Naviagent-config.000120:10592Restore/etc/Navisphere/.Naviagent-config.000121:14083 QuitSelect number 1 - 3.修改agent.conf

5、ig配置文件,主要方法如下:修改/etc/Navisphere/agent.configVi /etc/Navisphere/agent.config 修改内容为:# Navisphere agent.config# # This file is used by Navisphere Agent to configure# site specific values.# All entries in this file have this form:# object value-list# Where object tells what sort of information is to# be

6、 configured, and value-list is a# whitespace-separated list of values to be configured.# Samples, which should be edited, appear below for all# permissible types of objects.# White space (tabs, space, line-feeds,# carriage-returns) and blank lines are ignored;# To continue a line onto the next line,

7、 use as the# last character of that line. The is dropped when# the next line is concatenated to the continued line.# Description specification# # The clarDescr object takes arbitrary text values# intended to describe the agent and its location.#clarDescr Navisphere Agent# The clarContact object take

8、s arbitrary text values# intended to describe who is responsible for the# configured agent, and how to reach them.#clarContact John Smith, 800-555-1212# Device specification.# # The format of device objects for CLARiiON devices# is:# devicedevice-specname description# where the device-specification

9、is the device name to# open to access the CLARiiON device. It can be a# SCSI-2 file name. If this is auto, all attached# arrays with bound LUNs will be automatically# configured. (Currently, dummy arguments are required# for name and description, when using# auto-configuration.) This can NOT be defa

10、ulted.# The name is the per CLARiiON name that can be used to# identify each CLARiiON to the manager application.# The name is REQUIRED and cannot contain spaces (even# if surrounded by quotes). This can NOT be defaulted.# The description is a quoted string that contains a# brief description of the

11、CLARiiON chassis being# managed. It defaults to if not specified, and to# the device name for auto-configuration.# SAMPLES:# device c0t0d0 NAVISPHERE-1 NAVISPHERE-1# automatically detect manageable devicesdevice auto auto# User Specification.# # The format of user objects is# user localUserId# OR# u

12、ser userIdhostname在此处添加存储系统SPA和SPB管理地址即可user HYPERLINK mailto:systemXX.XX.XX.XX systemXX.XX.XX.XX user systemXX.XX.XX.XX# These build a list of users who are allowed to perform# WRITE operations to the CLARiiON devices managed by# this agent. By default, as specified below, only root# on this machin

13、e has WRITE access. Others can be# granted access by including their login name and host# which they can access from. A null list prevents# anyone, including admin, from having write access. In# order to get write access, this file would have to be# modified and the Agent stopped and restarted to# r

14、e-read the configuration file, or an appropriate# remote configuration file would have to be sent to the# agent from an already-priviledged user.user root # only on this machine#user sbluepicasso # individual user sblue on# host picasso#user lgreenhannibal # individual user lgreen on# host hannibal#

15、 Poll specification# # The poll object takes a numerical count of seconds.# This specifies how often the agent solicits# information from the array, rather than using cached# information. The minimum is 10.#poll 60# Eventlog specification# # The eventlog object takes a numerical count of log# entrie

16、s.# This defines the maximum number of SP log events# received by the agent on startup, and received by# clients per poll. A value of 0 causes the devices# entire log to be read at startup. A minimum of 100# events will be read on serial, and 2048 on fibre,# overriding any lower value configured bel

17、ow.#eventlog 100# Baud Rate specification# # If the agent is using a serial port to manage a# device, the next entry can specify either 9600 baud# or 19200 baud.#baud 9600# end of configuration file#保存配置文件,然后可以启动/停止agent服务。命令如下:bash3.00#/etc/init.d/agent stopbash3.00#/etc/init.d/agent start如果安装配置正常,

18、启动agent服务后在Navisphere Manager管理界面中的Connective中会看到链路状态register为yes。如register显示为no,可以考虑重启服务器或者重启agent服务,或者在Navisphere Manager界面中进行手动注册也可以。注册完成后会在链路状态中显示主机名称等信息。PowerPath的安装与注册PowerPath的安装1、Mount CDROM2、bash3.00# mkdir /unload3、bash3.00#cd /unload4、bash3.00#cp /. 从光盘将安装文件拷贝到新建的目录下面。5、bash3.00# gunzip 解

19、压缩文件6、bash3.00# tar -xvf 解压缩文件7、bash3.00#pkgadd d . 安装PowerPath按照下述提示操作:SPARC host:The following packages are available:EMCpower EMC PowerPath(sparc) 5.2.x_bxxxSelect package(s) you wish to process (or all toprocess all packages). (default: all) ?,?,q:x86 (i386) host:The following packages are avail

20、able:EMCpower EMC PowerPath(i386) 5.2.x_bxxxSelect package(s) you wish to process (or all toprocess all packages). (default: all) ?,?,q:Enter 1 and press ENTER. Enter package base directory (default: /opt):Press ENTER to accept the default base directory (/opt), or type thepath to an alternate base

21、directory and press ENTER.This package contains scripts which will be executedwith super-user permission during the process ofinstalling this package.Do you want to continue with the installation of y,n,?Enter y and press ENTER.Installation of was successful.8、安装完成后需要进行PowerPath的注册注册方法如下:bash3.00#/e

22、tc/emcpreg -installYou see the following output:= EMC PowerPath Registration =Do you have a new registration key or keys to enter? nType y and press ENTER.You see the following output:Enter the registration key(s) for your product(s),one per line, pressing Enter after each key.After typing all keys,

23、 press Enter again.Key (Enter if done):Enter the PowerPath registration key and press ENTER. You can alsoadd keys for other technologies, such as PowerPath MigrationEnabler or PowerPath Encryption with RSA.If you entered a valid key, you see the following output:1 key(s) successfully added.Key succe

24、ssfully installed.Key (Enter if done):Press ENTER. You see the following output if you entered one key:1 key(s) successfully registered.在PowerPath软件安装注册完成后重启服务器,输入下述命令可以看到服务器与存在之间的两条链路:bash3.00#powermt display dev=all会显示链路情况。还需要将Solaris主机的MPxIO功能关闭。(主要是由于Solaris自带的MPxIO功能与PowerPath的多路径功能相冲突)具体修改文件如下

25、:修改/kernel/drv/fp.conf,修改内容如下:mpxio-disable=yes修改/kernel/drv/scsi_vhci.conf,修改内容如下:mpxio-disable=yes修改完成后,运行如下命令:powermt display dev=all powermt check (Choose A for all. Clear the dead paths.) devfsadm C (Scan the SCSI bus.) powercf -q (Rebuild the logical link layer.) powermt config (Bring the devi

26、ce pathsinto PowerPath control.) powermt save (Save the current configuration.)完成配置保存等工作后PowerPath软件即可正常使用。存储建立RAID Group,Storage Group,将服务器与LUN映射关系对应上。服务器端识别存储,格式化硬盘以及做文件系统。具体操作如下:sh-3.00# formatSearching for disks.doneAVAILABLE DISK SELECTIONS: 0. c0t0d0 /pci1d,700000/scsi4/sd0,0 1. c0t8d0 /pci1d,

27、700000/scsi4/sd8,0 2. c3t0d0 /pci1d,700000/QLGC,qlc2/sd0,0 3. c3t1d0 /pci1d,700000/QLGC,qlc2/sd1,0 4. emcpower0a /pseudo/emcp0Specify disk (enter its number): 4selecting emcpower0adisk formattedFORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partiti

28、on table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze - surface analysis defect - defect list management backup - search for backup labels verify - read and display labels inquiry - show vendor, pr

29、oduct and revision volname - set 8-character volume name ! - execute , then return quitformat pPARTITION MENU: 0 - change 0 partition 1 - change 1 partition 2 - change 2 partition 3 - change 3 partition 4 - change 4 partition 5 - change 5 partition 6 - change 6 partition select - select a predefined

30、 table modify - modify a predefined partition table name - name the current table print - display the current table label - write partition map and label to the disk ! - execute , then return quitpartition pCurrent partition table (original):Total disk sectors available: 3076627422 + 16384 (reserved

31、 sectors)Part Tag Flag First Sector Size Last Sector0 root wm 34 128.00MB 262177 1 swap wu 262178 128.00MB 524321 2 unassigned wm 0 0 0 3 unassigned wm 0 0 0 4 unassigned wm 0 0 0 5 unassigned wm 0 0 0 6 usr wm 524322 1.43TB 3076627421 8 reserved wm 3076627422 8.00MB 3076643805 partition labelReady

32、to label disk, continue? ypartition qFORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze

33、- surface analysis defect - defect list management backup - search for backup labels verify - read and display labels inquiry - show vendor, product and revision volname - set 8-character volume name ! - execute , then return quitformat q创建文件系统,Solaris默认格式bash-3.00# newfs /dev/rdsk/emcpower0g newfs:

34、 建构新的文件系统 /dev/rdsk/ emcpower0g: (y/n)? y警告:最后一个未分配柱面中的 1104 扇区/dev/rdsk/ emcpower0g: 在 500668 磁道上,48 扇区的 128 柱面的 3076103088 扇区1502003.5MB 在 3502 柱面群组 (143 c/g, 429.00MB/g, 448 i/g)超块 (fsck -F ufs -o b=#) 备份在:32, 878752, 1757472, 2636192, 3514912, 4393632, 5272352, 6151072, 7029792, 7908512,初始化柱面组:最

35、后 10 个柱面组的超级块备份位置: 3068047904, 3068926624, 3069805344, 3070684064, 3071562784, 3072441504, 3073320224, 3074198944, 3075077664, 3075956384,文件系统做完。挂载硬盘bash-3.00# mkdir emcdiskbash-3.00# mount /dev/dsk/ emcpower0g /mnt/emcdisk/其它链路也如上述操作,完成后运行下面命令可以看到磁盘大小以及利用情况。bash-3.00# df -kh文件系统 大小 用了 可用 容量 挂接在/dev

36、/dsk/c0t0d0s0 32G 1.1G 30G 4% /devices 0K 0K 0K 0% /devicesctfs 0K 0K 0K 0% /system/contractproc 0K 0K 0K 0% /procmnttab 0K 0K 0K 0% /etc/mnttabswap 2.1G 1.0M 2.1G 1% /etc/svc/volatileobjfs 0K 0K 0K 0% /system/object/dev/dsk/c0t0d0s3 23G 4.3G 19G 19% /usrfd 0K 0K 0K 0% /dev/fd/dev/dsk/c0t8d0s7 67G 7

37、43M 66G 2% /varswap 2.1G 312K 2.1G 1% /tmpswap 2.1G 24K 2.1G 1% /var/run/dev/dsk/c0t0d0s6 1.2G 83M 1.1G 7% /temp/dev/dsk/c0t0d0s7 10G 1.9G 8.2G 19% /export/home/dev/dsk/emcpower0g 1.4T 64M 1.4T 1% /mnt/emcdisk硬盘自动挂载,修改配置文件,配置文件在/etc/vfstab具体修改参考下面文档:bash-3.00# vi /etc/vfstab#device device mount FS f

38、sck mount mount#to mount to fsck point type pass at boot options#fd - /dev/fd fd - no -/proc - /proc proc - no -/dev/dsk/c0t0d0s1 - - swap - no -/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -/dev/dsk/c0t0d0s3 /dev/rdsk/c0t0d0s3 /usr ufs 1 no -/dev/dsk/c0t8d0s7 /dev/rdsk/c0t8d0s7 /var ufs 1 no -/d

39、ev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes -/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /temp ufs 2 yes -/devices - /devices devfs - no -ctfs - /system/contract ctfs - no -objfs - /system/object objfs - no -swap - /tmp tmpfs - yes -/dev/dsk/emcpower0g /dev/rdsk/emcpower0g /mnt/emcdisk ufs 1

40、yes -光纤交换机配置zone光纤交换机主要配置管理ip地址,zone等,在初始化时已经完成了ip地址的配置,配置zone的方法如下:SW200E:admin switchshow 查看交换机信息switchName: SW200EswitchType: 34.0switchState: Online switchMode: NativeswitchRole: PrincipalswitchDomain: 1switchId: fffc01switchWwn: 10:00:00:05:1e:5b:f7:3ezoning: ON (XXXX)switchBeacon: OFFArea Port

41、 Media Speed State Proto= 0 0 id N4 Online F-Port 21:00:00:1b:32:08:2a:d4 1 1 id N4 Online F-Port 50:06:01:69:41:e0:b2:5f 2 2 id N4 Online F-Port 50:06:01:61:41:e0:b2:5f 3 3 id N4 Online F-Port 21:00:00:e0:8b:8f:57:b3 4 4 id N4 Online F-Port 21:00:00:e0:8b:8f:a8:b3 5 5 id N4 No_Light 6 6 id N4 No_Li

42、ght 7 7 id N4 No_Light 8 8 - N4 No_Module (No POD License) Disabled 9 9 - N4 No_Module (No POD License) Disabled 10 10 - N4 No_Module (No POD License) Disabled 11 11 - N4 No_Module (No POD License) Disabled 12 12 - N4 No_Module (No POD License) Disabled 13 13 - N4 No_Module (No POD License) Disabled

43、 14 14 - N4 No_Module (No POD License) Disabled 15 15 - N4 No_Module (No POD License) DisabledSW200E:admin alicreate “SPA_0”,” 50:06:01:69:41:e0:b2:5f” /创建WWN的别名SW200E:admin alicreate “SPB_0”,” 50:06:01:61:41:e0:b2:5f”SW200E:admin alicreate “mailbak”,” 21:00:00:e0:8b:8f:57:b3”SW200E:admin alicreate

44、“student_mail”,” 21:00:00:1b:32:08:2a:d4”SW200E:admin alicreate “v490”,” 21:00:00:e0:8b:8f:a8:b3”SW200E:admin zonecreate “bak”,” SPA_0; SPB_0; mailbak” /创建zoneSW200E:admin zonecreate “mail”,” SPA_0; SPB_0; v490”SW200E:admin zonecreate “st_mail”,” SPA_0; SPB_0; student_mail”SW200E:admin cfgcreate XXX

45、X, bak; mail ;st_mail /创建cfgSW200E:admin cfgsave “XXXX” /保存cfgSW200E:admin cfgenable “XXXX” /enable cfg配置完成。可以通过switchshow、fabricshow、zoneshow、cfgshow等查看配置。一定要注意创建别名时WWN的准确性。其它注意事项以及特殊情况处理:PowerPath链路不正常情况下的处理PowerPath链路不正常主要有几种情况:链路识别不了解决办法:重启服务器。或者使用如下命令:bash3.00#powermt checkbash3.00#powermt rest

46、ore扫描通道bash3.00#powercf q bash3.00#powermt configbash3.00#powermt save在Navisphere Manager上检查链路发现情况,如发现不了,进行扫描,检查HBA卡状态,如果状态不对,需要安装HBA卡驱动。链路数量状态不对当链路数量状态不对时可以使用A中所提到的命令进行链路通道扫描,同时结合Navisphere Manager 检查链路情况,可以运行CTRL+ALT+SHIFT+F12进入工程师配置模式,密码是messner.检查链路以及Storage Group主机配置信息是否勾选。同时也可以检查光纤交换机配置信息。修改So

47、laris配置文件系统不能启动的问题在修改vfstab等文件造成系统启动不起来,需要采用单用户模式将配置文件修改后再重启即可。主要方法如下:1插入Solaris 10光盘2利用光盘启动到单用户模式ok boot cdrom -s3装配/(root)文件系统到/a目录,以允许对磁盘上的文件系统的访问。# mount /dev/dsk/c0t0d0s0 /a4设置并且输出TERM变量允许vi编辑器进行工作# TERM=sun# export TERM5编辑/etc/vfstab文件并且纠正问题。然后退出保存文件# vi /a/etc/vfstab:wq!6卸载文件系统# cd /# umount

48、/a7重新启动系统# reboot附录资料:不需要的可以自行删除bat文件的基本应用bat是dos下的批处理文件 .cmd是nt内核命令行环境的另一种批处理文件 从更广义的角度来看,unix的shell脚本以及其它操作系统甚至应用程序中由外壳进行解释执行的文本,都具有与批处理文件十分相似的作用,而且同样是由专用解释器以行为单位解释执行,这种文本形式更通用的称谓是脚本语言。所以从某个程度分析,batch, unix shell, awk, basic, perl 等脚本语言都是一样的,只不过应用的范围和解释的平台各有不同而已。甚至有些应用程序仍然沿用批处理这一称呼,而其内容和扩展名与dos的批处

49、理却又完全不同。 = 首先批处理文件是一个文本文件,这个文件的每一行都是一条DOS命令(大部分时候就好象我们在DOS提示符下执行的命令行一样),你可以使用DOS下的Edit或者Windows的记事本(notepad)等任何文本文件编辑工具创建和修改批处理文件。 = 注 = 批处理文件中完全可以使用非dos命令,甚至可以使用不具有可执行特性的普通数据性文件,这缘于windows系统这个新型解释平台的涉入,使得批处理的应用越来越边缘化。所以我们讨论的批处理应该限定在dos环境或者命令行环境中,否则很多观念和设定都需要做比较大的变动。 = 其次,批处理文件是一种简单的程序,可以通过条件语句(if)和

50、流程控制语句(goto)来控制命令运行的流程,在批处理中也可以使用循环语句(for)来循环执行一条命令。当然,批处理文件的编程能力与C语言等编程语句比起来是十分有限的,也是十分不规范的。批处理的程序语句就是一条条的DOS命令(包括内部命令和外部命令),而批处理的能力主要取决于你所使用的命令。 = 注 = 批处理文件(batch file)也可以称之为批处理程序(batch program),这一点与编译型语言有所不同,就c语言来说,扩展名为c或者cpp的文件可以称之为c语言文件或者c语言源代码,但只有编译连接后的exe文件才可以称之为c语言程序。因为批处理文件本身既具有文本的可读性,又具有程序

51、的可执行性,这些称谓的界限是比较模糊的。 = 第三,每个编写好的批处理文件都相当于一个DOS的外部命令,你可以把它所在的目录放到你的DOS搜索路径(path)中来使得它可以在任意位置运行。一个良好的习惯是在硬盘上建立一个bat或者batch目录(例如C:BATCH),然后将所有你编写的批处理文件放到该目录中,这样只要在path中设置上c:batch,你就可以在任意位置运行所有你编写的批处理程序。 = 注 = 纯以dos系统而言,可执行程序大约可以细分为五类,依照执行优先级由高到低排列分别是:DOSKEY宏命令(预先驻留内存),COMMAND.COM中的内部命令(根据内存的环境随时进驻内存),以

52、com为扩展名的可执行程序(由 直接载入内存),以exe位扩展名的可执行程序(由 重定位后载入内存),以bat位扩展名的批处理程序(由 解释分析,根据其内容按优先级顺序调用第2,3,4,5种可执行程序,分析一行,执行一行,文件本身不载入内存) = 第四,在DOS和Win9x/Me系统下,C:盘根目录下的AUTOEXEC.BAT批处理文件是自动运行批处理文件,每次系统启动时会自动运行该文件,你可以将系统每次启动时都要运行的命令放入该文件中,例如设置搜索路径,调入鼠标驱动和磁盘缓存,设置系统环境变量等。下面是一个运行于Windows 98下的autoexec.bat的示例: ECHO OFF PA

53、TH C:WINDOWS;C:WINDOWSCOMMAND;C:UCDOS;C:DOSTools; C:SYSTOOLS;C:WINTOOLS;C:BATCH LH SMARTDRV.EXE /X LH DOSKEY.COM /insert LH CTMOUSE.EXE SET TEMP=D:TEMP SET TMP=D:TEMP = 注 = AUTOEXEC.BAT为DOS系统的自动运行批处理文件,由COMMAND.COM启动时解释执行; 而在Win9x环境中,不仅增加支持了 DOSSTART.BAT, WINSTART.BAT 等许多其它自动运行的批处理文件,对AUTOEXEC.BAT 也

54、增加了 .DOS .W40 .BAK .OLD .PWS 等许多变体以适应复杂的环境和多变的需求。 = willsort 编注 = 以下关于命令的分类,有很多值得推敲的地方。常用命令中的本不是命令,而dir、copy等也很常用的命令却没有列入, 而特殊命令中所有命令对我来说都是常用命令。建议将批处理所引用的命令分为内部命令、外部命令、第三方程序三类。而内部命令和外部命令中别有一类是专用于或常用于批处理中的命令可称之为批处理命令。 以下摘录MS-DOS 6.22 帮助文档中关于批处理命令的文字,当然,其中有些概念和定义已经有些落后了。 批处理命令 批处理文件或批处理程序是一个包含若干MS-DOS

55、命令的正文文件,扩展名为.BAT。当在命令提示符下敲入批处理程序的名称时,MS-DOS成组执行此批处理程序中的命令。 任何在命令提示符下可使用的命令都可用在批处理程序中。此外,下面MS-DOS命令是专门在批处理程序中使用的。 = 常用命令 echo、call、pause、rem(小技巧:用:代替rem)是批处理文件最常用的几个命令,我们就从他们开始学起。 = 注 = 首先, 不是一个命令, 而是DOS 批处理的一个特殊标记符, 仅用于屏蔽命令行回显. 下面是DOS命令行或批处理中可能会见到的一些特殊标记符: CR(0D) 命令行结束符 Escape(1B) ANSI转义字符引导符 Space(

56、20) 常用的参数界定符 Tab(09) ; = 不常用的参数界定符 + COPY命令文件连接符 * ? 文件通配符 字符串界定符 | 命令管道符 文件重定向符 命令行回显屏蔽符 / 参数开关引导符 : 批处理标签引导符 % 批处理变量引导符 其次, : 确实可以起到rem 的注释作用, 而且更简洁有效; 但有两点需要注意: 第一, 除了 : 之外, 任何以 :开头的字符行, 在批处理中都被视作标号, 而直接忽略其后的所有内容, 只是为了与正常的标号相区别, 建议使用 goto 所无法识别的标号, 即在 :后紧跟一个非字母数字的一个特殊符号. 第二, 与rem 不同的是, :后的字符行在执行时

57、不会回显, 无论是否用echo on打开命令行回显状态, 因为命令解释器不认为他是一个有效的命令行, 就此点来看, rem 在某些场合下将比 : 更为适用; 另外, rem 可以用于 config.sys 文件中. = echo 表示显示此命令后的字符 echo off 表示在此语句后所有运行的命令都不显示命令行本身 与echo off相象,但它是加在每个命令行的最前面,表示运行时不显示这一行的命令行(只能影响当前行)。 call 调用另一个批处理文件(如果不用call而直接调用别的批处理文件,那么执行完那个批处理文件后将无法返回当前文件并执行当前文件的后续命令)。 pause 运行此句会暂停

58、批处理的执行并在屏幕上显示Press any key to continue.的提示,等待用户按任意键后继续 rem 表示此命令后的字符为解释行(注释),不执行,只是给自己今后参考用的(相当于程序中的注释)。 = 注 = 此处的描述较为混乱, 不如直接引用个命令的命令行帮助更为条理 ECHO 当程序运行时,显示或隐藏批处理程序中的正文。也可用于允许或禁止命令的回显。 在运行批处理程序时,MS-DOS一般在屏幕上显示(回显)批处理程序中的命令。 使用ECHO命令可关闭此功能。 语法 ECHO ON|OFF 若要用echo命令显示一条命令,可用下述语法: echo message 参数 ON|OF

59、F 指定是否允许命令的回显。若要显示当前的ECHO的设置,可使用不带参数的ECHO 命令。 message 指定让MS-DOS在屏幕上显示的正文。 CALL 从一个批处理程序中调用另一个批处理程序,而不会引起第一个批处理的中止。 语法 CALL drive:pathfilename batch-parameters 参数 drive:pathfilename 指定要调用的批处理程序的名字及其存放处。文件名必须用.BAT作扩展名。 batch-parameters 指定批处理程序所需的命令行信息。 PAUSE 暂停批处理程序的执行并显示一条消息,提示用户按任意键继续执行。只能在批处 理程序中使用

60、该命令。 语法 PAUSE REM 在批处理文件或CONFIG.SYS中加入注解。也可用REM命令来屏蔽命令(在CONFIG.SYS 中也可以用分号 ; 代替REM命令,但在批处理文件中则不能替代)。 语法 REM string 参数 string 指定要屏蔽的命令或要包含的注解。 = 例1:用edit编辑a.bat文件,输入下列内容后存盘为c:a.bat,执行该批处理文件后可实现:将根目录中所有文件写入 a.txt中,启动UCDOS,进入WPS等功能。 批处理文件的内容为: 命令注释: echo off 不显示后续命令行及当前命令行 dir c:*.* a.txt 将c盘文件列表写入a.tx

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论