BAT或者VBS,搜索某个文件夹,并改名。
BAT或者VBS,搜索某个文件夹,并改名。不知道是在那个子目录里面。要找到99999这个文件夹,改为88888命名的文件夹。谢谢。不是这样的了,我要搜索的文件夹我并不知道...
BAT或者VBS,搜索某个文件夹,并改名。
不知道是在那个子目录里面。要找到99999这个文件夹,改为88888命名的文件夹。
谢谢。
不是这样的了 ,我要搜索的文件夹我并不知道是哪个盘的哪个文件夹里面。。
lanny119您的可以,但是如果原来有这个文件夹名酒不能改啊,可以搜索之后先删除88888的文件夹,再把99999改成88888文件夹吗? 展开
不知道是在那个子目录里面。要找到99999这个文件夹,改为88888命名的文件夹。
谢谢。
不是这样的了 ,我要搜索的文件夹我并不知道是哪个盘的哪个文件夹里面。。
lanny119您的可以,但是如果原来有这个文件夹名酒不能改啊,可以搜索之后先删除88888的文件夹,再把99999改成88888文件夹吗? 展开
展开全部
那就在加上一句就可以了,不过搜索速度就很慢了
不好意思,粗心了,有两处语法错误,以经修改,修改后如下:
@echo off
set _DISK=c d e f g h i j k l m n o p q r s t u v w x y z
for %%i in (%_DISK%) do (
for /f "delims=""" %%j in ('dir /b /s /ad %%i:\ 2^> nul ^| findstr 99999$') do (
echo %%j
ren "%%j" 88888
)
)
pause
不好意思,粗心了,有两处语法错误,以经修改,修改后如下:
@echo off
set _DISK=c d e f g h i j k l m n o p q r s t u v w x y z
for %%i in (%_DISK%) do (
for /f "delims=""" %%j in ('dir /b /s /ad %%i:\ 2^> nul ^| findstr 99999$') do (
echo %%j
ren "%%j" 88888
)
)
pause
参考资料: http://hi.baidu.com/ynnal911
展开全部
代码如下,搜索c/d/e/f盘
-----------------------------
@echo off
pushd c:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
del /f 0616.txt
popd
pushd d:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
del /f 0616.txt
popd
pushd e:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
popd
pushd f:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
popd
pause
-----------------------------------
我的写法和他们的不一样~~~自己好好看看吧··挺简单的~~
-----------------------------
@echo off
pushd c:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
del /f 0616.txt
popd
pushd d:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
del /f 0616.txt
popd
pushd e:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
popd
pushd f:\
dir /s /b 99999>>0616.txt
for /f %%i in (0616.txt) do (
rename %%i 88888
)
popd
pause
-----------------------------------
我的写法和他们的不一样~~~自己好好看看吧··挺简单的~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
全盘搜索所有磁盘及目录,包括映射的网络磁盘,修改所有名称符合的目录名,但不包括无权限的路径. 本地测试已通过
Const ExpFolderName = "99999"
Const FixFolderName = "88888"
Dim curFolder
Set objWsh = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
For Each disk in GetObject ("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select name, size from Win32_LogicalDisk")
If disk.size >0 Then
Set drive = objFso.GetFolder(disk.name)
FindFolder drive
End If
Next
Sub FindFolder(folder)
On Error Resume Next
For Each subFolder In folder.SubFolders
If Err.Number = 0 Then
If subFolder.Name = ExpFolderName Then
WScript.Echo "Expected folder is founded, the path is "&subFolder.path
folderPath = subFolder.ParentFolder.path
subFolder.Name = FixFolderName
If objFso.FolderExists(folderPath&"\"&FixFolderName) Then
WScript.Echo "The folder name '"&ExpFolderName&"' has been changed to '"&FixFolderName&"'."
Else
WScript.Echo subFolder.Path
WScript.Echo "Rename Failed"
End If
End If
FindFolder subFolder
Else
Err.Clear
End If
Next
End Sub
Const ExpFolderName = "99999"
Const FixFolderName = "88888"
Dim curFolder
Set objWsh = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
For Each disk in GetObject ("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select name, size from Win32_LogicalDisk")
If disk.size >0 Then
Set drive = objFso.GetFolder(disk.name)
FindFolder drive
End If
Next
Sub FindFolder(folder)
On Error Resume Next
For Each subFolder In folder.SubFolders
If Err.Number = 0 Then
If subFolder.Name = ExpFolderName Then
WScript.Echo "Expected folder is founded, the path is "&subFolder.path
folderPath = subFolder.ParentFolder.path
subFolder.Name = FixFolderName
If objFso.FolderExists(folderPath&"\"&FixFolderName) Then
WScript.Echo "The folder name '"&ExpFolderName&"' has been changed to '"&FixFolderName&"'."
Else
WScript.Echo subFolder.Path
WScript.Echo "Rename Failed"
End If
End If
FindFolder subFolder
Else
Err.Clear
End If
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
@echo off
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z
) do for /f "delims=" %%a in ('dir /ad /s /b %%i:99999') do (if exist "%%a" (%%i:ren "%%a" "88888"
start "%%a"
))
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z
) do for /f "delims=" %%a in ('dir /ad /s /b %%i:99999') do (if exist "%%a" (%%i:ren "%%a" "88888"
start "%%a"
))
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询