Page 1 of 1
No Idea Whats Happening?
Posted: 28 Jul 2012 21:35
by Notelek_Labs
ok, so when I run the exe Snapz.exe it takes a picture with the webcam and saves it in the same directory as itself as snapz.dib, I rename it and move it to another directory. BUT what ends up happening is that when I run this a picture shows up where I expect it to in the F:\security\face.png BUT the picture that shows up is the picture that was taken the previous time that I run this code. Why?
Code: Select all
start "" /b "snapz.exe"
ren snapz.dib face.png
move /-y "F:\DATA\face.png" "F:\security\"
del snapz.dib
Re: No Idea Whats Happening?
Posted: 29 Jul 2012 02:01
by foxidrive
Any good?
Code: Select all
del snapz.dib 2>nul
start "" /b "snapz.exe"
ren snapz.dib face.png
move /-y "face.png" "F:\security\"
del snapz.dib
Re: No Idea Whats Happening?
Posted: 29 Jul 2012 08:11
by Squashman
You can use the move command to rename at the same time. You should have no need to delete the dib file if you are renaming it.
Re: No Idea Whats Happening?
Posted: 29 Jul 2012 08:22
by foxidrive
So this should work - was the start command there for a reason?
Note that the /-y can leave the snapz.dib in place - but the lower del command will remove it.
And I added the pushd to change to the snapz folder - so modify that.
Code: Select all
@echo off
pushd "c:\snapz"
del snapz.dib 2>nul
"snapz.exe"
move /-y "snapz.dib" "F:\security\face.png"
del snapz.dib 2>nul
popd