+ Post New Thread
Results 1 to 4 of 4
Windows Thread, Check if a profile exits....help in Technical; Hello all, I need a short script that will check if a user profile is present on the local C: ...
  1. #1

    Join Date
    Jan 2010
    Location
    Stockport
    Posts
    75
    Thank Post
    39
    Thanked 4 Times in 2 Posts
    Rep Power
    9

    Check if a profile exits....help

    Hello all,
    I need a short script that will check if a user profile is present on the local C: drive, and if it is it will then do a task.

    I was thinking along the lines of:-

    If exits C:\users\%username% then…….

    Or

    If exits “C:\Documents and Settings\%username%” then……

    But it seems to be falling over with the following error after it is run…..

    C:\users\student1 was unexpected at this time

    So the user name is identified but the script stops

    Any ideas?

    Thanks

    John

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,404
    Thank Post
    797
    Thanked 1,591 Times in 1,394 Posts
    Blog Entries
    10
    Rep Power
    428
    Is it a VBS script?

    If so stick this at the top

    Code:
    On error resume next

    Maybe the thread should be moved here: http://www.edugeek.net/forums/scripts/
    Last edited by FN-GM; 27th April 2010 at 06:31 PM.

  3. #3

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,714
    Thank Post
    269
    Thanked 1,116 Times in 1,012 Posts
    Rep Power
    345
    erm how about

    If not exist C:\path\to\profile goto end

    Command you want if it does exist

    End

    example

    Code:
    if not exist C:\user\student goto end 
    
    xcopy C:\user\student \\server\share /d /g /h
    
    end

    just change the xcopy command to whatever you would like to do with it

    More Info on If command http://www.computerhope.com/if.htm
    Last edited by glennda; 27th April 2010 at 06:58 PM. Reason: And More info

  4. #4

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    Have you just made a typo copying it here? You've used "exits" but you need "exist" (no S at the end; S in the middle)

    (note if you do move to VBScript then it becomes "fileexists" or "folderexists" - there is an S on the end)

    Otherwise, I can't see anything wrong with what you've got - it should work

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 8
    Last Post: 4th February 2011, 03:29 PM
  2. Roaming Profile desktop check
    By rh91uk in forum Scripts
    Replies: 0
    Last Post: 17th March 2010, 10:59 AM
  3. Users Roaming Profile wont load, cannot delete profile on server?
    By jamin100 in forum Windows Server 2000/2003
    Replies: 8
    Last Post: 8th January 2010, 03:43 PM
  4. Replies: 0
    Last Post: 12th November 2008, 11:01 AM
  5. Replies: 5
    Last Post: 21st August 2007, 08:02 AM

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
  •