+ Post New Thread
Results 1 to 7 of 7
Windows Thread, IF EXISTfile. .BAT still runs in Technical; Hi, Im trying to create a bat file to install Sophos. The batch file should check if the Sophos installed ...
  1. #1

    Join Date
    Nov 2011
    Posts
    628
    Thank Post
    87
    Thanked 21 Times in 19 Posts
    Rep Power
    10

    IF EXISTfile. .BAT still runs

    Hi,

    Im trying to create a bat file to install Sophos. The batch file should check if the Sophos installed file exists and run if it doesn't.

    The problem im getting is that if the file exists it still runs the command


    Code:
    IF exist C:\Windows\System32\SophosInstalled.txt (copy "\\SERVER\Apps\Sophos\SophosInstalled.txt" "C:\SophosInstalled.txt")

  2. #2

    Jawloms's Avatar
    Join Date
    Aug 2007
    Posts
    834
    Thank Post
    177
    Thanked 105 Times in 73 Posts
    Rep Power
    185
    Not following the logic of your copy. It checks to see if a text file exists in C:\Windows\System32, then copies it to the root of C if it does?
    Last edited by Jawloms; 12th February 2014 at 11:21 AM.

  3. Thanks to Jawloms from:

    dany2010 (12th February 2014)

  4. #3

    Join Date
    Nov 2011
    Posts
    628
    Thank Post
    87
    Thanked 21 Times in 19 Posts
    Rep Power
    10
    think I neet a not exists oops. will give it a go


    Update: sorry, my fault. Needed NOT exists. Not awake enough.
    Last edited by dany2010; 12th February 2014 at 11:28 AM.

  5. #4


    Join Date
    Jan 2012
    Posts
    2,974
    Thank Post
    1,115
    Thanked 441 Times in 323 Posts
    Rep Power
    228
    Still not following the logic, either.

    Code:
    IF NOT EXIST C:\Windows\System32\SophosInstalled.txt (copy "\\SERVER\Apps\Sophos\SophosInstalled.txt" "C:\SophosInstalled.txt")
    This script will continuously run every boot/login/$trigger because it's checking the local System32 for a file, and, if the file doesn't exist, it will copy a file (of the same name) from \\Server to the local machine.
    But you've told it to copy to C:\ - Next time the script executes it will check System32 for SophosInstalled.txt just like it's been told to, and guess what? It still isn't there, so it'll re-copy the file (again to C:\)

    Ad Infinitum

  6. Thanks to Garacesh from:

    dany2010 (12th February 2014)

  7. #5

    Join Date
    Nov 2011
    Posts
    628
    Thank Post
    87
    Thanked 21 Times in 19 Posts
    Rep Power
    10
    Yeah, was juggling 10 things at once. That was me half way through testing to see if the administrator could only see the system32 directory.

    Didnt try running like that but obviously copied at the wrong time.

  8. #6
    kennysarmy's Avatar
    Join Date
    Oct 2005
    Location
    UK
    Posts
    1,318
    Thank Post
    83
    Thanked 47 Times in 33 Posts
    Rep Power
    31
    Why don't you push sophos out from the enterprise console? or have I missed something?

  9. #7

    Join Date
    Nov 2011
    Posts
    628
    Thank Post
    87
    Thanked 21 Times in 19 Posts
    Rep Power
    10
    Quote Originally Posted by kennysarmy View Post
    Why don't you push sophos out from the enterprise console? or have I missed something?
    Another step in the install process to show everyone when they only just cope with clicking two tick boxes. Sometimes forget that to.

    Where we only have 3 hours at the site I have setup mdt and wds so that once I click the go button I know it will work without me touching it again.

    I have the console to roll out proxy and all the other settings automatically and the script to just install and contact the server.

SHARE:
+ Post New Thread

Similar Threads

  1. What is the oldest server OS that you still run?
    By bart21 in forum General Chat
    Replies: 19
    Last Post: 20th August 2012, 04:07 PM
  2. [For Sale] RM One Laptop battery charging station - if anyone's still using them...?!
    By ben604 in forum Classified Adverts
    Replies: 0
    Last Post: 30th April 2012, 02:40 PM
  3. Is anyone still running IE6 for a reason?
    By jamesfed in forum Windows
    Replies: 8
    Last Post: 6th September 2010, 04:40 PM
  4. Replies: 1
    Last Post: 26th February 2010, 09:31 AM
  5. Replies: 0
    Last Post: 27th September 2007, 08:11 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •