![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-13 22:40 |
47,812 topics / 349,916 posts / today 0 new / 48,268 members |
| 论坛回收站 » Newcomer asks a newbie question |
| Printable Version 8,930 / 2 |
| Floor1 jqh2004 | Posted 2010-12-02 09:27 |
| 新手上路 Posts 9 Credits 10 | |
|
The function of the code is to find all MP3 files in each D drive and its subfolders.
Dim WshShell set WshShell = CreateObject("wscript.Shell") WshShell.Run "d:\findfile.bat" The code in findfile.bat is as follows: @echo off dir *.mp3 /a-d /b /s>>result.txt pause This is the VBS I wrote to run a bat code, but it always prompts that the file is not found. Depressed. I don't know the reason. The output result is also not good. Why? |
|
| Floor2 Hanyeguxing | Posted 2010-12-02 11:26 |
| 银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂 | |
|
Write *.mp3 as d:\*.mp3
|
|
| Floor3 jqh2004 | Posted 2010-12-02 14:35 |
| 新手上路 Posts 9 Credits 10 | |
|
Set fso = CreateObject("scripting.filesystemobject")
Set Shell = CreateObject("Shell.application") Set aa = Shell.BrowseForFolder(0, "Please select the folder:", 0) p=aa.Self.Path fso.CopyFile "d:\findfile.bat",p I want to first select a folder (using the VBS method), and then read the MP3 files in the subfolders and all folders below. So I thought of this method: copy the BAT file that reads MP3 files to the selected folder, and then execute it. Because I don't know how to pass the return value of the VBS path to the BAT, I can only copy the BAT to the corresponding folder and then run it. But it seems that when running, the path executed in the BAT is the folder where the VBS file is located. The return value is incorrect. It shows that the file is not found. I don't know if I explained it clearly. Because I mainly want to use the file selection dialog function of VBS. I'm not very good at using BAT. I haven't learned variable delay yet. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |