Kashis
asked on
Batch file question, with Vista
Ok i am incredibly unfamiliar with batch files. Im trying to get one to work in windows Vista.
everytime i run the batch file it displays "the system cannot find the file specified"
This is whats in the batch file:
FOR /F "tokens=*" %%D IN ('DIR "C:\Program Files\amtlib.dll" /S /B') DO copy /Y "amtlib.dll" "%%D"
pause
Now the amtlib.dll is in the same file as the batch file, and I am running it as an administrator.
I think im using windows vista.
So the question is how do i get the .bat file to work? thanks!
everytime i run the batch file it displays "the system cannot find the file specified"
This is whats in the batch file:
FOR /F "tokens=*" %%D IN ('DIR "C:\Program Files\amtlib.dll" /S /B') DO copy /Y "amtlib.dll" "%%D"
pause
Now the amtlib.dll is in the same file as the batch file, and I am running it as an administrator.
I think im using windows vista.
So the question is how do i get the .bat file to work? thanks!
ASKER
im right clicking on it and hitting run as administrator. i think i have the 64 bit version of windows, im not sure tho
ASKER
They are in the same folder. I dont know why its not working
Verify that your file path is correct & the file is there; C:\Program Files\amtlib.dll
If you're running Vista 64 the path may be C:\Program Files (x86)\
Also verify that your file amtlib.dll is in the same directory as the batch file your executing.
Optionally you can provide the full path to the file your copying (source file).
i.e.
FOR /F "tokens=*" %%D IN ('DIR "C:\Program Files\amtlib.dll" /S /B') DO copy /Y "C:\Users\UserName\Desktop \amtlib.dl l" "%%D"
This assumes that you're amtlib.dll file is on the desktop of user called 'UserName'. Adjust the path to where the file is located accordingly.
If you're running Vista 64 the path may be C:\Program Files (x86)\
Also verify that your file amtlib.dll is in the same directory as the batch file your executing.
Optionally you can provide the full path to the file your copying (source file).
i.e.
FOR /F "tokens=*" %%D IN ('DIR "C:\Program Files\amtlib.dll" /S /B') DO copy /Y "C:\Users\UserName\Desktop
This assumes that you're amtlib.dll file is on the desktop of user called 'UserName'. Adjust the path to where the file is located accordingly.
ASKER
still saying the file cant be found.
ive tried having the batch file in the same directory as the .dll file
ive tried what you said, neither is working.
Im on a Sony Vaio, if that helps
ive tried having the batch file in the same directory as the .dll file
ive tried what you said, neither is working.
Im on a Sony Vaio, if that helps
To make sure the amtlib.dll is taken out of the same folder as the batch file, add this:
FOR /F "tokens=*" %%D IN ('DIR "C:\Program Files\amtlib.dll" /S /B') DO copy /Y "%%~dpDamtlib.dll" "%%D"
ASKER
I did as Qlemo said and it said that the file cannot be copied onto itself.
the batch file is in a folder on the desktop. so its not in the program file directory.
I think we are making progress tho
the batch file is in a folder on the desktop. so its not in the program file directory.
I think we are making progress tho
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wow your good. that worked.
Thanks!
Thanks!
ASKER
YOUR THE BEST! THANKS!!!!!!!
I think im using windows vista. "
amtlib.dll must be in the same folder as the batch file unless you specify the full path.
I just ran a test using your script on my machine (substituting amtlib.dll with blah.txt) and had no issues. I also had a different copy of blah.txt in the same working directory as my batch file.
Are you clicking on the batch file to execute it or using something else to call it? If you're using something else to call it you may need to specify the full path of the file you're wanting to copy.