Having troubles with a batch script.

Toshiba Satellite a200-st2041 notebook
July 25, 2009 at 08:25:58
Specs: Windows Vista
I'm trying to make a batch file that checks if there is a .exe in a folder and if there is, renames it and copys it to the location of the batch file, then i want it to remove the .exe from its original location and run the copy, after that i want the batch file to start over.

I added pause so i could check each step when running it, i will remove these upon completion.

I have this so far:
:begin
if exist \\COLIN-PC\Shared Doc's\*.exe goto exist
goto begin
:exist
pause
ren \\COLIN-PC\Shared Doc's\*.exe battoexecute.exe
pause
copy \\COLIN-PC\Shared Doc's\battoexecute.exe battoexecute.exe
pause
del \\COLIN-PC\Shared Doc's\battoexecute.exe
pause
start battoexecute.exe
pause
goto begin
Thanks
P.S. Sorry if I posted in wrong section, I'm new to computing.net :-)

"An open mind leaves a chance for someone to drop a worthwhile thought into it."


See More: Having troubles with a batch script.

Report •


#1
July 25, 2009 at 11:44:52
I’m a bit out of date with the syntax of the commands but it appears to me that:

1. If a .exe file doesn’t exist, it loops back to begin, when you should be exiting.
2. The rename will not work properly if more than one .exe exists.
3. At the end, after running the program, you loop back to begin again in a never ending loop.


Report •

#2
July 25, 2009 at 12:18:41
The problem is that when I put a .exe in the specified file it doesn't notice.

There would only be one .exe in there at a time so rename wouldn't be an issue by the way.

"An open mind leaves a chance for someone to drop a worthwhile thought into it."


Report •

Related Solutions


Ask Question