Find a File
Does anyone know how to script a "find a file on a computer" type script?
Basically, I was hoping to create a while statement that does one part until it no longer sees a file on the targeted machine, once the "findfile" = false then it would kick of the second part of the script.
something like:
while checkfile = false
do this staement
if checkfile = true
do this statment
end
I have my statements and everything working... I just need something that looks at a certain file path and verifies if a file has been removed or not, then report true or false back so the next part of the program can start.
2 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
SMal.tmcc
9 years ago
you should be able to use an "if exists then" statement to delete the file and then call the the second part of your script. use start /wait to keep them sequenced
start /wait if exists "file" then delete
start /wait part 2 of your script
http://ss64.com/nt/if.html
start /wait if exists "file" then delete
start /wait part 2 of your script
http://ss64.com/nt/if.html
Posted by:
SMal.tmcc
9 years ago
here is a lttle more depth to my issue.
I am uninstalling a program on a computer. I have a statement that does that - so I am good there. I am then running a statement that installs a different program - again, I have this working as well.
what I need though is a way to delay the install until the uninstall is completed. So I was hoping I could have a way to search for a file that exsits in program 1 (and keep searching until it can no longer be found). Once the file search returns "false" then program 2 launchs.
I don't want the "check file" statement to actually do anything with the files, execpt see if a it is on the machine. Otherwise, it returns a value that I can then use to launch the next step. - jsnyder213 9 years ago
what type of script? If it is a batch script you are pushing this type of call will work as a batch script.
start /wait call uninstall command
start /wait call install command
the start /wait will make sure the uninstall has run prior to starting the install - SMal.tmcc 9 years ago