![]() |
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-08-09 08:11 |
47,811 topics / 349,895 posts / today 0 new / 48,253 members |
| DOS批处理 & 脚本技术(批处理室) » Question about what's wrong with my batch file |
| Printable Version 804 / 12 |
| Floor1 wang6542975 | Posted 2008-07-23 11:03 |
| 初级用户 Posts 62 Credits 123 | |
|
set /p filename=Customer Data
set alldrive=f for %%i in (%alldrive%) do if exist %%i:\ dir /b %%i:| find "%filename%" move %filename% e:\win pause The original idea was to search for Customer Data under all drive letters and then MOVE it to the e:\win folder, but I found there was a problem so I changed it to search only f: But after changing it to f:, it still doesn't work |
|
| Floor2 523066680 | Posted 2008-07-23 11:15 |
| 银牌会员 Posts 1,133 Credits 2,362 | |
|
I'm puzzled too. Sometimes with find "string", the string is clearly there, but it just won't show up.
I just tested it, and with find "string", the string is case-sensitive. I searched for the If_Exist folder, success if_exist did not work |
|
| Floor3 wang6542975 | Posted 2008-07-23 11:26 |
| 初级用户 Posts 62 Credits 123 | |
|
I'm really puzzled... I've already tested the letter case and it still doesn't work..
For example, if what I'm searching for is "Customer Data", do Chinese characters have upper/lower case too?? |
|
| Floor4 radem | Posted 2008-07-23 11:32 |
| 高级用户 Posts 383 Credits 691 | |
|
set /p filename=Customer Data
In this, "Customer Data" is the displayed prompt text, not the value of filename |
|
| Floor5 HAT | Posted 2008-07-23 11:37 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Remove the /p switch from the set command
|
|
| Floor6 523066680 | Posted 2008-07-23 11:41 |
| 银牌会员 Posts 1,133 Credits 2,362 | |
|
I feel this batch file has a big problem... it seems...
I was almost driven crazy... this is the code I tested successfully myself @echo off set /p filename=":" if exist f:\%filename% move f:\%filename% e:\ (The check in if exist f:\%filename% already includes checking whether drive f exists, so it's direct and simple) |
|
| Floor7 wang6542975 | Posted 2008-07-23 11:46 |
| 初级用户 Posts 62 Credits 123 | |
|
After removing the /p switch, it can find the Customer Data folder, but it still can't move it, saying access denied. The folder location and file are not the problem..
Still hoping for advice |
|
| Floor8 wang6542975 | Posted 2008-07-23 11:51 |
| 初级用户 Posts 62 Credits 123 | |
|
.. It says the system cannot find the specified file, sorry, I misread it.
I thought it was a directory problem, then I put the batch file under the Customer Data folder and ran it, but that still didn't work.. |
|
| Floor9 wang6542975 | Posted 2008-07-23 12:02 |
| 初级用户 Posts 62 Credits 123 | |
|
It seems to be a problem with the MOVE command.
|
|
| Floor10 523066680 | Posted 2008-07-23 14:27 |
| 银牌会员 Posts 1,133 Credits 2,362 | |
|
Depressing, extremely depressing!!!
(Hope you can take screenshots of the relevant images and post them in the thread so everyone can have a look) |
|
| Floor11 moniuming | Posted 2008-07-23 17:11 |
| 银牌会员 Posts 574 Credits 1,335 From 广西 | |
| Floor12 wang6542975 | Posted 2008-07-23 17:25 |
| 初级用户 Posts 62 Credits 123 | |
|
Such a clear line of thinking is really worth studying carefully!!
By the way, what if it's a folder named "Customer Data"? MOVE the "Customer Data" folder to E:\WIN I tried it, and it seems rather difficult.. |
|
| Floor13 moniuming | Posted 2008-07-23 17:55 |
| 银牌会员 Posts 574 Credits 1,335 From 广西 | |
|
Try this?
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |