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: ...
27th April 2010, 07:23 PM #1
- Rep Power
Check if a profile exits....help
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…….
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
IDG Tech News
27th April 2010, 07:26 PM #2
Is it a VBS script?
If so stick this at the top
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 07:31 PM.
27th April 2010, 07:57 PM #3
erm how about
If not exist C:\path\to\profile goto end
Command you want if it does exist
if not exist C:\user\student goto end
xcopy C:\user\student \\server\share /d /g /h
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 07:58 PM.
Reason: And More info
27th April 2010, 10:06 PM #4
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
By adamchapman in forum Windows
Last Post: 4th February 2011, 04:29 PM
By rh91uk in forum Scripts
Last Post: 17th March 2010, 11:59 AM
By jamin100 in forum Windows Server 2000/2003
Last Post: 8th January 2010, 04:43 PM
By contink in forum Windows
Last Post: 12th November 2008, 12:01 PM
Last Post: 21st August 2007, 09:02 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)