bewlay51 Posted April 27, 2010 Posted April 27, 2010 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
FN-GM Posted April 27, 2010 Posted April 27, 2010 (edited) 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/ Edited April 27, 2010 by FN-GM
glennda Posted April 27, 2010 Posted April 27, 2010 (edited) erm how about If not exist C:\path\to\profile goto end Command you want if it does exist End example 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 Edited April 27, 2010 by glennda And More info
srochford Posted April 27, 2010 Posted April 27, 2010 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now