Close

Results 1 to 14 of 14
  1. #1
    DF VIP Member
    liveseytowers's Avatar
    Join Date
    Aug 2007
    Location
    Bristol, Unite
    Posts
    7,756
    Thanks
    495
    Thanked:        251
    Karma Level
    644

    Help Help making a batch file

    I've got to compile a list of PC's that have a certain file on the root of their C Drive. I've tried to do this via LANDesk but its not working too well and the LANDesk support forums recommend adding something into our logon script.

    I have a file on some of our C drives called image version.txt

    I need to add something to the script that will write the computer name to a text file if image version.txt exists.

    Can anyone help? We are using .kix script if that makes a difference.

  2. #2
    DF VIP Member ap0c's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    937
    Thanks
    132
    Thanked:        38
    Karma Level
    260

    Default Re: Help making a batch file

    I can knock up a vb6 exe that you can add to your logon bat if you like. all you need to do is make sure the exe is on a drive visible to all the other pc's. I do something similar here to log when users are using specific pc's in the building.
    Never take friendship personal.

  3. #3
    DF VIP Member
    liveseytowers's Avatar
    Join Date
    Aug 2007
    Location
    Bristol, Unite
    Posts
    7,756
    Thanks
    495
    Thanked:        251
    Karma Level
    644

    Default Re: Help making a batch file

    Quote Originally Posted by ap0c View Post
    I can knock up a vb6 exe that you can add to your logon bat if you like. all you need to do is make sure the exe is on a drive visible to all the other pc's. I do something similar here to log when users are using specific pc's in the building.
    If you can that would be ace mate. Will it output to a text file in the same directory that the .exe is run from? The file that I need to locate is called image version.txt and is on the root of the C Drive.

  4. #4
    DF VIP Member
    beerman's Avatar
    Join Date
    May 2001
    Location
    29 Acacia Road
    Posts
    8,446
    Thanks
    1,080
    Thanked:        1,626
    Karma Level
    957

    Default Re: Help making a batch file

    can you not add a random reg key if that file exists? Landesk as far as I can remember can search by regkeys.

  5. #5
    DF VIP Member ap0c's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    937
    Thanks
    132
    Thanked:        38
    Karma Level
    260

    Default Re: Help making a batch file

    there you go mate

    searches for "image version.txt" and writes to "results.txt". "results.txt" must reside in the same dir as the exe or it wont work - also make sure that its writeable by the clients logging on
    Last edited by ap0c; 12th May 2009 at 04:05 PM.
    Never take friendship personal.

  6. #6
    DF VIP Member
    liveseytowers's Avatar
    Join Date
    Aug 2007
    Location
    Bristol, Unite
    Posts
    7,756
    Thanks
    495
    Thanked:        251
    Karma Level
    644

    Default Re: Help making a batch file

    Quote Originally Posted by ap0c View Post
    there you go mate

    searches for "image version.txt" and writes to "results.txt". "results.txt" must reside in the same dir as the exe or it wont work - also make sure that its writeable by the clients logging on
    Cheers ap0c, what is it meant to do? I've scanned it for viruses (no offence but I didn't it compiling all my passwords etc lol) and ran it but nothing happens? I'm assuming I can just click on it without putting it my script?

    I'm thinking about a reg entry as well as like beerman says LANDesk will report on it.

  7. #7
    DF VIP Member ap0c's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    937
    Thanks
    132
    Thanked:        38
    Karma Level
    260

    Default Re: Help making a batch file

    put it on a shared folder on the network and then add the line to your logon batch file to run it, when some1 logs on to a machine it will run the exe and if the file is found you will see the hostname of the pc that ran it added to the text file.

    You can test it locally by putting a file called "image version.txt" in the root of your C:\ and then run the exe, if you open up the results.txt you will see your pc name listed!
    Never take friendship personal.

  8. #8
    DF VIP Member
    liveseytowers's Avatar
    Join Date
    Aug 2007
    Location
    Bristol, Unite
    Posts
    7,756
    Thanks
    495
    Thanked:        251
    Karma Level
    644

    Default Re: Help making a batch file

    Quote Originally Posted by ap0c View Post
    put it on a shared folder on the network and then add the line to your logon batch file to run it, when some1 logs on to a machine it will run the exe and if the file is found you will see the hostname of the pc that ran it added to the text file.

    You can test it locally by putting a file called "image version.txt" in the root of your C:\ and then run the exe, if you open up the results.txt you will see your pc name listed!
    Cheers ap0c i though that's what i needed to do. When I run it it creates a text file called results however its blank. You any idea's?

  9. #9
    DF VIP Member nitelife's Avatar
    Join Date
    Nov 2002
    Location
    Reading, Berks
    Posts
    1,170
    Thanks
    115
    Thanked:        13
    Karma Level
    337

    Default Re: Help making a batch file

    You could just use a simple windows batch file. Here's one that seems to do want you want.

    Code:
    @echo off
    IF NOT EXIST "c:\image version.txt" GOTO DONOTHING
    echo %COMPUTERNAME% >> test.txt
    
    :DONOTHING
    This checks for a file called image version.txt on c:\, if it exists then it appends the current computer name onto the end of the file test.txt. If test.txt doesn't exist then it will be created.

    If you want to add this to your logon script add everything after the @echo off and change test.txt to the file of your choice in the location of your choice.

    Note that it doesn't check for duplicates, but its simple and easy to use. That means that if a user logs on multiple times you will have multple entries in the file, but that's probably not going to happen that much.

  10. #10
    DF VIP Member ap0c's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    937
    Thanks
    132
    Thanked:        38
    Karma Level
    260

    Default Re: Help making a batch file

    Quote Originally Posted by liveseytowers View Post
    Cheers ap0c i though that's what i needed to do. When I run it it creates a text file called results however its blank. You any idea's?
    Make sure that when you run it there is already a results.txt file in the same directory as the exe or it will not work, remember it will only add to the text file if the exe is run on a pc that has the "image version.txt" in the root of C:
    Never take friendship personal.

  11. #11
    DF VIP Member ap0c's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    937
    Thanks
    132
    Thanked:        38
    Karma Level
    260

    Default Re: Help making a batch file

    Quote Originally Posted by nitelife View Post
    You could just use a simple windows batch file. Here's one that seems to do want you want.

    Code:
    @echo off
    IF NOT EXIST "c:\image version.txt" GOTO DONOTHING
    echo %COMPUTERNAME% >> test.txt
    
    :DONOTHING
    This checks for a file called image version.txt on c:\, if it exists then it appends the current computer name onto the end of the file test.txt. If test.txt doesn't exist then it will be created.

    If you want to add this to your logon script add everything after the @echo off and change test.txt to the file of your choice in the location of your choice.

    Note that it doesn't check for duplicates, but its simple and easy to use. That means that if a user logs on multiple times you will have multple entries in the file, but that's probably not going to happen that much.
    alot simpler, cheers, my bat file powers are weak but this is a nice solution!
    Never take friendship personal.

  12. #12
    DF VIP Member nitelife's Avatar
    Join Date
    Nov 2002
    Location
    Reading, Berks
    Posts
    1,170
    Thanks
    115
    Thanked:        13
    Karma Level
    337

    Default Re: Help making a batch file

    Quote Originally Posted by ap0c View Post
    alot simpler, cheers, my bat file powers are weak but this is a nice solution!
    Your welcome mate. It took me a while to remember how to do it as well.

  13. #13
    DF VIP Member
    liveseytowers's Avatar
    Join Date
    Aug 2007
    Location
    Bristol, Unite
    Posts
    7,756
    Thanks
    495
    Thanked:        251
    Karma Level
    644

    Default Re: Help making a batch file

    Quote Originally Posted by nitelife View Post
    You could just use a simple windows batch file. Here's one that seems to do want you want.

    Code:
    @echo off
    IF NOT EXIST "c:\image version.txt" GOTO DONOTHING
    echo %COMPUTERNAME% >> test.txt
    
    :DONOTHING
    This checks for a file called image version.txt on c:\, if it exists then it appends the current computer name onto the end of the file test.txt. If test.txt doesn't exist then it will be created.

    If you want to add this to your logon script add everything after the @echo off and change test.txt to the file of your choice in the location of your choice.

    Note that it doesn't check for duplicates, but its simple and easy to use. That means that if a user logs on multiple times you will have multple entries in the file, but that's probably not going to happen that much.
    That is a nice solution mate, i'll give it a try this afternoon

  14. #14
    DF VIP Member Mr.James's Avatar
    Join Date
    Nov 2000
    Location
    town
    Posts
    4,264
    Thanks
    233
    Thanked:        408
    Karma Level
    576

    Default Re: Help making a batch file

    Code:
    @IF EXIST "C:\IMAGE VERSION.TXT" ECHO %COMPUTERNAME% >> X:\list.txt
    Add that to your logon script replacing X:\ with a network drive that all users have write access too...

Similar Threads

  1. gta3 save file 4 u all (pc)
    By neilmachin in forum PC Gaming
    Replies: 6
    Last Post: 14th January 2003, 01:52 PM
  2. Wicked Flash File
    By Pegasus in forum The Dog and Duck
    Replies: 11
    Last Post: 13th November 2002, 11:46 PM
  3. making usb drive bootable
    By disastermaster in forum PC Problems
    Replies: 3
    Last Post: 11th September 2002, 06:49 PM
  4. T100 To T108 Flash File
    By BAZZO69 in forum Unlocking Questions & Solutions
    Replies: 7
    Last Post: 4th September 2002, 07:53 PM

Social Networking Bookmarks

Posting Permissions

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