No Idea Whats Happening?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Notelek_Labs
Posts: 16
Joined: 22 Jul 2012 20:26

No Idea Whats Happening?

#1 Post by Notelek_Labs » 28 Jul 2012 21:35

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

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: No Idea Whats Happening?

#2 Post by foxidrive » 29 Jul 2012 02:01

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

Squashman
Expert
Posts: 4484
Joined: 23 Dec 2011 13:59

Re: No Idea Whats Happening?

#3 Post by Squashman » 29 Jul 2012 08:11

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.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: No Idea Whats Happening?

#4 Post by foxidrive » 29 Jul 2012 08:22

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

Post Reply