= = = = = = = = =
here is x.bat:
= = = = = = = = =
@echo off
set theTime=%time%
set /a thesec=%theTime:~6,2%
set /a num0=%random%+1
set /a prod=%num0%*%thesec%
set /p var=%26lt;current.txt
del %var%\hi.txt /q
rmdir %var%
mkdir %prod%
copy template.txt %prod%\hi.txt /y
echo %prod% %26gt; current.txt
cmd
= = = = = = =
Here is what the batch file x.bat is supposed to do:
x.bat copies template.txt (as "hi.txt" ) to a randomly generated folder and substitutes the new folders name into "current.txt" (replacing "123"), deletes "hi.txt" from "123" and removes folder "123"
the folder "b" contains files:
current.txt, template.txt, the batch file x.bat
and initially:
a folder called "123" containing a file "hi.txt"
the file "current.txt" initially contains the name ("123") of the folder.
why does it try to delete a file "hi.txt" also from the root "C:" ?
AND
why does it throw an error if the seconds value of the computer clock = "09" ?
Crazy batch file question?
Wild guess, thesec variable is including the colon.
Don't use environment variables when extracting paths from files.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment