大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> 程序开发 -> 用VB实现文件改名

用VB实现文件改名

时间: 2021-07-31 作者:daque

本领一name从新定名一个文献、目次、或文献夹。语法:name oldpathname as newpathname name语句从新定名文献并将其挪动到一个各别的目次或文献夹中。如有需要,name可跨启动器挪动文献。但当newpathname和oldpathname都在沟通的启动器中时,只能从新定名仍旧生存的目次或文献夹。name不许创造新文献、目次或文献夹。在一个已翻开的文献上运用name,将会爆发缺点。必需在变换称呼之前,先封闭翻开的文献。name参数不许囊括多字符(*)和单字符(?)的通配符。示例本示例运用name语句来变动文献的称呼。示例中假如一切运用到的目次或文献夹都已生存。在macintosh中,默许启动器称呼是c, imoldname,newnameoldname="oldfile":newname="newfile"解释:设置文献名。nameoldnameasnewname解释:变动文献名。oldname="c:\mydir\oldfile":newname="c:\yourdir\newfile"nameoldnameasnewname解释:变动文献名,并挪动文献。★★★★★★★★★★★★★★★★★★★★★★★★★★ 本领二option explicit解释: // shell file operationsconst fo_move = &h1const fo_copy = &h2const fo_delete = &h3const fo_rename = &h4const fof_multidestfiles = &h1const fof_confirmmouse = &h2const fof_silent = &h4 解释: don解释:t create progress/reportconst fof_renameoncollision = &h8const fof_noconfirmation = &h10 解释: don解释:t prompt the user.const fof_wantmappinghandle = &h20 解释: fill in shfileopstruct.hnamemappings解释: must be freed using shfreenamemappingsconst fof_allowundo = &h40const fof_filesonly = &h80 解释: on *.*, do only filesconst fof_simpleprogress = &h100 解释: means don解释:t show names of filesconst fof_noconfirmmkdir = &h200 解释: don解释:t confirm making any needed dirsconst po_delete = &h13 解释: printer is being deletedconst po_rename = &h14 解释: printer is being renamedconst po_portchange = &h20 解释: port this printer connected to is being changed解释: if this id is set, the strings received by解释: the copyhook are a doubly-null terminated解释: list of strings. the first is the printer解释: name and the second is the printer port.const po_ren_port = &h34 解释: po_rename and po_portchange at same time.private type shfileopstructhwnd as longwfunc as longpfrom as stringpto as stringfflags as integerfanyoperationsaborted as longhnamemappings as longlpszprogresstitle as string 解释: only used if fof_simpleprogressend type解释:private declare function shfileoperation lib "shell32.dll" alias " shfileoperationa" (lpfileop as shfileopstruct) as longprivate declare function shfileoperation lib "shell32.dll" (lpfileop as shfileopstruct) as longprivate sub command1_click()dim tud as shfileopstructdim rc as longwith tud.hwnd = me.hwnd.pfrom = "c:\aaa.txt".pto = "c:\bbb.txt".fflags = fof_allowundo.wfunc = fo_renameend withrc = shfileoperation(tud)end sub★★★★★★★★★★★★★★★★★★★★★★★★★★ 本领三private sub command1_click()dim icmd as objectset icmd = createobject("wscript.shell")icmd.run "command.com /c rename c:\test.txt aa.txt", 0, trueend sub可運行任何dos吩咐,2000下需用cmd.exe 

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.