First off, I think the code we were last working with was:
Set newname=%RANDOM%.%RANDOM%
ren %1 %newname%
DEL %~d1%~p1%newname%
pause
exit
and the info I received in a DOS window with echo on was:
c:\Documents and Settings\user>Set newname=725.23907
c:\Documents and Settings\user>ren "C:\Documents and Settings\user\desktop\test.txt" 725.23907
c:\Documents and Settings\user>DEL C:\Documents and Settings\user\desktop\725.23907
The system cannot find the file specified.They were indeed my typo's. Retying all the info from the dos window gets annoying, i used shout names
to shorten what I had to type.
Try not using quotes on the passed parameter, you're using short names anyway so they're not required.
All I am doing is dragging the file I want deleted to the shortcut to the batch file, the quotes on the passed parameters is what DOS spits out as an
echo to the commands in the batch file.
THUS:
cmd = Set newname=%RANDOM%.%RANDOM%
echo = D:\Documents and Settings\user>Set newname=725.23907
cmd = ren %1 %newname%
echo = C:\Documents and Settings\user>ren "C:\Documents and Settings\user\desktop\test.txt" 725.23907
cmd = DEL %~d1%~p1%newname%
echo = C:\Documents and Settings\user>DEL C:\Documents and Settings\user\desktop\725.23907
The system cannot find the file specified.What's interesting is that when the REN cmd is issued the echo uses qoutes on the parameters while when the DEL cmd is issued it does not.
Bones92,I ran it from cmd.exe, if that makes a difference...
Not sure what you mean here, does cmd.exe need to be called from within a batch file? Or ae you saying you types cmd,exe in the run field to open a DOS window? I believe the dos batch file does use cmd.exe for exicution.