linux 脚本语法,100个必会的shell脚本语法

该文通过详细的步骤演示了如何通过VB获取网卡地址

'Handle Errors

On Error Resume Next

'Get the provider object

Set prov=GetObject("WinNT:")

'Examine the available domains the provider can reach

For each dom in prov

'Examine the objects in the domain and check for Computer objects

For each o in dom

If o.Class="Computer" Then

'Display properties of the Computer

WScript.Echo o.Class & " " & o.Name

WScript.Echo " Owner: " & o.Owner

WScript.Echo " Division: " & o.Division

WScript.Echo " OperatingSystem: " & o.OperatingSystem

WScript.Echo " OS Version: " & o.OperatingSystemVersion

WScript.Echo " Processor: " & o.Processor

WScript.Echo " ProcessorCount: " & o.ProcessorCount

End If

Next

Next6c40f921a0fc4a8d07467429fda2c190.png

if fso.fileexists(deskpath&""&OldFileName1 ) then

set f=fso.getfile(deskpath&""&OldFileName1)

f.name=newFileName1

end if

但是若您希望只有单行,不要多行,则必须判断User是否按了EnterKey,那只好在TextBox的KeyPress中加入以下程序码,以去除Enter的作用:

PrivateSubText1_KeyPress(KeyAsciiAsInteger)

IfKeyAscii=vbKeyReturnThen

KeyAscii=0

EndIf->

运行成功

一、用data控件进行数据库链接,可以这样:

在form_load()过程中放入:

privateform_load()

DimstrAsString'定义

str=App.Path

IfRight(str,1)<>""Then

str=str ""

EndIf

data1.databasename=str&"\数据库名"

data1.recordsource="数据表名"

data1.refresh

subend

这几句话的意为,打开当前程序运行的目录下的数据库

如果调用vb组件,可以是:

flag=&h200

whichone=OpenFile("ChooseaFile!","C:","Everything|*.*|TextFiles|*.TXT|Word-Documents|*.DOC",2,flag)

MsgBox"Rawdatareturned:"&whichone

'Splitupmultiselectionresult:

'spaceisusedasseparator:

whichone=Split(whichone,"")

'fieldindex0containspathinformation:

path=whichone(0)

'listallthefiles:

'howmanyfileswereselected?

filecount=UBound(whichone)

iffilecount=0then

'justonefileselected!

MsgBox"Youselectedonefile:"&whichone(0)

'checkstatusofReadOnlycheckbox

'isbit1setorcleared?

'worksonlyifjustonefilewasselected!

MsgBox"Returnedflag:"&flag

if(flagand1)then

'(flagand1)<>0,transformstotrue

'bitisset!

MsgBox"ReadOnlyselected!"

else

MsgBox"ReadOnlynotselected!"

endIf

'checkwhetherselectedfileisofdefaulttype(txt)

if(flagand1024)then

MsgBox"selectedfileisnotxtfile!"

else

MsgBox"selectedfileisofdefaulttype!"

endif

else

'morethanonefileselected!

MsgBox"Youselected"&filecount&"files!"

forx=1toUBound(whichone)

list=list&path&whichone(x)&vbCr

next

MsgBoxlist

endIf

functionOpenFile(title,dir,filter,index,flags)

setcomdlg=CreateObject("MSComDlg.CommonDialog")

comdlg.filter=filter

comdlg.FilterIndex=index

comdlg.Flags=flags

comdlg.MaxFileSize=260

comdlg.CancelError=false

comdlg.DialogTitle=title

comdlg.InitDir=dir

'settxtasdefault

comdlg.DefaultExt="txt"

comdlg.ShowOpen

OpenFile=comdlg.filename

'important:returnflagstatussoyourmainscriptcan

'checkit:

flags=comdlg.Flags

endfunction

组件相关文件下载图像的切换技术能明显美化画面

以往我们需要从1循环到100然后求和,但利用数组的这个特性我们可以通过简单的一行代码搞定,代码如下:

此外可以做很多类似的数学运算,比如以下几个

这些我们以往都通过循环进行的计算,现在都可以一行代码巧妙搞定,不得不叹服编程语言隐含的灵巧,编程的世界总有太多的东西等待我们去发现突发事件桌面推演

Tracks当前MCI设备的轨道数

下面我们给IE添加一个“复制图像地址”的右键菜单,步骤如下:

VB新建一个ActiveX Dll工程,工程名:NetCopyURL,将默认生成的类名改为clsCopyURL

在clsCopyURL.cls中添加如下代码:

Public Sub CopyImageURL(URL As String)

Clipboard.Clear

Clipboard.SetText URL

End Sub

执行File->Make NetCopyURL.dll生成动态链接库文件NetCopyURL.dll

拷贝NetCopyURL.dll到C:\Windows\System32文件夹

运行开始->所有程序->附件->命令提示符,输入如下命令注册dll:Regsvr32 C:\Windows\System32\NetCopyURL.dll

打开记事本,敲入以下内容,并存储到C:\Program Files\CopyImageUrl\CopyUrl.htm。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值