1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Not If exist checking

Discussion in 'Software Development' started by desmin, Jul 10, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. desmin

    desmin Banned Thread Starter

    Joined:
    Jul 10, 2007
    Messages:
    57
    im making another script to go along with my google search script but it isnt working
    here my code
    Code:
    @echo off
    TITLE test
    
    if exist http://www.eliteknifesquad.com/EKSwall.zip goto exit
    
    :exit
    DEL "C:\Documents and Settings\Billy\Desktop\del\del.txt"
    its not checking if that exists (which it doesnt)and just deletes it anyway

    can the cmd even access internet besides command PING
    at ip refresh and that stuff
    thx in advance
     
  2. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    Code:
    @echo off
    TITLE test
    
    if exist http://www.eliteknifesquad.com/EKSwall.zip goto exit
    
    :exit
    DEL "C:\Documents and Settings\Billy\Desktop\del\del.txt"
    Either way it's going to delete that file. After the goto, you need to stop the rest of the code from running, or it will. Dos keeps running the commands in order as listed unless you direct it otherwise.

    Like this example:

    Code:
    if  exist http://www.eliteknifesquad.com/EKSwall.zip goto last
    exit
    
    :last
    DEL "C:\Documents and Settings\Billy\Desktop\del\del.txt" 
     
  3. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    I'm not sure you can check for a file on the web like that using If Exist. I'll have to play and see.

    EDIT: Nope. Exactly what did you want to do? Are you just checking to see if a file exists and if it does, then delete another file on your desktop?

    Look at downloading a utility named Wget tp download files.
     
  4. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    You can use WGET with the Spider Switch ( no file is downloaded) and the -o switch to output to a text file. (to capture the Server Response) Then you can use the find utility to check the output file for Not Found to determine if the File was found or not and act accordingly.

    The rest is up to you. Hope this helps.
     
  5. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
  6. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    Hi Squashman,

    That link is to some code which would be used if you had a programming language named BlitzBasic installed.

    They happened to have written the code and named the function If Exist as a coincidence.

    However, Windows won't know what to do with that code unless it's used with the correct files installed to interpret.


    Mo
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/594205

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice