1.

Solve : move can't find specified file?

Answer»

when i run the following the move command, it says 'the system cannot find the file specified'
rem ****************
echo move %%1 "..\extra" >> ask_em.bat
 
rem ****************but the following line works just fine
echo if errorlevel 1 if not errorlevel 2 echo moved %%1 >> ask_em.bat

this one calls manage.bat

echo off
:init
echo *********************************************
echo again y/n
choice /c:yn
if errorlevel 2 if not errorlevel 3 goto outofit
rem if errorlevel 1 if not errorlevel 2 goto init
call "manage.bat" *.*
goto init
:outofit


****************   this is manage.bat
echo off
if exist "..\extra\flagyes.txt" goto main
md "..\extra"
echo here > "..\extra\flagyes.txt"
:main
echo echo {m}ove/ {s}tay file> ask_em.bat
echo echo. >> ask_em.bat
echo echo %%1 >> ask_em.bat
echo echo. >> ask_em.bat
echo choice /c:ms >> ask_em.bat
echo echo. >> ask_em.bat
echo if errorlevel 2 if not errorlevel 3 goto outofit >> ask_em.bat
rem ****************this one doesn't work
rem echo move %%1 "..\extra" >> ask_em.bat
rem ****************but the following line works just fine
rem echo if errorlevel 1 if not errorlevel 2 echo moved %%1 >> ask_em.bat
echo :outofit >> ask_em.bat
for %%i in (%1) do call ask_em.bat %%i
:outofit
del ask_em.bat
quotes need escaping (by doubling them)

try this

echo move %%1 ""..\extra"" >> ask_em.batthxs tried the double quotes, doesn't seem to change anything, even no quotes doesn't affect anything.
i must be losing something some where cause when i run the following it doesn't lose the file.

echo if errorlevel 1 if not errorlevel 2 echo moved %%1 >> ask_em.bat

when run, this one spits out the correct name for %%1

but when i run
echo move %%1 ""..\extra"" >> ask_em.bat
or
echo move %%1 "..\extra" >> ask_em.bat
or even
echo move %%1 ..\extra >> ask_em.bat
it TELLS me: **the system cannot find the file specified file**
i'm startin to thinke echoing the line to ask_em.bat is whats messing me up. do i need special characters in front of the individual % in the line thats echoed to ask_em.bat? Quote from: jprime hope on December 02, 2009, 06:14:01 AM

do i need special characters in front of the individual % in the line thats echoed to ask_em.bat?

Sorry I should have spotted that! To echo a percent sign you do need a special character in front of each one. The special character is a percent sign. Thus %%a becomes %%%%a

this line in manage.bat:
echo move %%%%1 "..\extra" >> "..\extra\ask_em.bat"
produces an ask_em.bat line--** move %%1 "..\extra" **

this line in manage.bat:
echo move %%%1 "..\extra" >> "..\extra\ask_em.bat"
produces an ask_em.bat line--**move %*.* "..\extra"

this line in manage.bat:
echo move %%1 "..\extra" >> "..\extra\ask_em.bat"
produces an ask_em.bat line--**move %1 "..\extra"

but all give--   the system cannot find..........
it's like dos is losing the VALUE of %%1 by the time it goes to echo it to ask_em.batit seems if i echo %1 instead of moving %1, dos doesn't lose the name

this works---------------------echo %1

but this doen't -----------------move %1 "..\extra"

and the following
'insert own code here' >> "..\extra\ask_em.bat"
sends the stuff preceding the '>'  without a prob when i'm trying to build ask_em.batGod I am slow today.

You made a fundamental error.

In a batch file you only use two percent signs with a letter or number like this %%A for a loop variable.

You are passing a parameter from 1 batch file to another. You use one percent sign in front of a number so you need %1.

Start from that and see how you go.

By the way that is a crazy way to do the task.

Also, each time you run it, it moves both batch files into ..\extra

what exactly are you tring to do here?





i know my code is lame, but i was trying to thin down my tunes (> 8000) and just wanted something to display the name, give me a choice to move or not move it to an over flow directory. would be redundantly, grateful for any n all suggestions on how else to do it. 
i must be missing something here
this statement works
echo if errorlevel 1 if not errorlevel 2 echo move %%1 >> "..\extra\ask_em.bat"
but this does not
echo if errorlevel 1 if not errorlevel 2 move %%1 "..\extra" >> "..\extra\ask_em.bat"

the first one will display the name, the second gives the 'can not find error'. by USING the word echo in front it will at least print the name ( i understand i'm not moving anything, just displaying the name) but least it doesn't lose the name.
  You want to display 8000 filenames and ask to move each one?

no just to go thru n list the files one at a time, giving me the option to move it to n extra/overflow directory. then my player will have less files to deal wit, espicially redundant or extra files, i have some times 3,4 or more files of the same song, some times exactly the same length, sometimes only longer or shorter by a few bytes,. n since even some differant tunes, can be the same length, i can't sort by length or title for that manner, as some of the same files can have names that DIFFER by a single character. but be the same tune. i thought buy reducing the total #'s i would hopefully reduce the time, speeding things up, not the playing (which is fine) but the managing of them. Why don't you just use Windows Explorer, which was made for this kind of job?
have used it 4 this, but it was so sloowwww that way, .  i thought since i like dos anyway n wanted to expand my dos relm understanding the same time, i could design it so it would feed me the files one a time, then by one button press i could send it to overflowland n move on to the next. i figured this would be faster then Explorer. i mean with 8000> maybe 8500> files to process in Explorer, all i could see was tedium beyound understanding.
also, can't stand the computer getting the better of me by gum. And since i want to understand what is happening here (knowledge is power), i will prob keep plodding along so that i may use this some future, if it's usable that isI agree. I'll try to think of some tips so WATCH this space.


Discussion

No Comment Found