Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch file

Status
Not open for further replies.

sheel

Technical User
Mar 9, 2001
74

I need create a batch file to copy a custom.dic to each individual Microsoft folder. Can some guide me what command should I use. I don't want copy through windows it's taking lot of time.

Currently i am using:
copy C:\custom.dic c:\winnt\profiles\%username\appl~1\etc
The %username% only copies to one indvidual if i need to dump that file in everyone's folder how do i that?

Thank you,
 
Make it a logon script for each user. Then %username% will be appropriate for whoever is running it.

Or you could delete the existing profiles and put that file in the Default User\Application Settings directory so that next time the users log on, a new profile will be generated with the appropriate files in it.

The actual direct answer to your question is to use Excel to help you generate a script (putting "copy C:\custom.dic c:\winnt\profiles\" in the first column, the username in the second column, and the remainder of the script in the third), but you will have to type in each users name (or at least each user with a profile on the computer) in the column that you are using to take the place of %username% in your script. You would then save the excel document as a comma-delimited file and use Find/Replace to delete all the commas. Then you can save it as a ".bat" file and run it. I think my first suggestion is the best though.

ShackDaddy
 
Hi,

I'm looking to do the same type of thing but with a shortcut icon on the desk top. I want to put shortcut to our Quality database out there. I'm guessing the best way to do it is to put it in "C:\Documents and Settings\All Users\Desktop". i think the problem is it will get stuck when the file is already there.

so here is my attempt at the line in my logon.bat.

copy \\NETWORK_SERVER_\general\shortcuts\qualitydb C:\Documents and Settings\All Users\Desktop /y

Where qualitydb is the shortcut.

does that look like it will work? our "general" drive letter is 'I'. so i could also try:
copy I:\shortcuts\qualitydb C:\Documents and Settings\All Users\Desktop /y

Does this look like it will work?
thanks,
_ALEX
 
alexlights,

Try this for your batch file.



IF EXIST "c:\filename.ext" Goto EndJob
Goto InstallPatch

:InstallPatch
copy n:\filename.ext c:\filename.ext

:EndJob
rem nothing here, end the batch file.
Echo ************************
Echo * Patched Previously *
Echo ************************
EXIT
 
ok, here is what i have. sorry for the long path. I'll work on makeing the network on shorter, but is should sill work just the same:

IF EXIST "C:\Documents and Settings\All Users\Desktop\Quality Procedure Database.mdb" Goto end
pause
copy I:\Quailty System\Quality System Procedures\Quality System Database\Quality Procedure Database.mdb C:\Documents and Settings\All Users\Desktop\
pause

goto end

:end


It does not work. I think the problem is becuase of the spaces in the directory path. Is there a work around for this. I have control of where the file actually lives, but there is nothing i can do on the local machine. We all have XP, or Win2000 and "Documents and Settings\All Users" is where I think I want this to go.

This is a shortcut i'm trying to copy, not the actual database.

Thanks for the help,
_ALEX
 
your copy statement doesn't have any "'s around it. Any path with spaces needs to have "'s around them.

If it still doesn't work. run the batch file and cut and paste the results for me.

I'd hazzard a guess that we'll see a "can not be found" message when running the "copy" line.
 
ok toetag,

i put the quotes in and i still get the same error message about file cannot be found.

IF EXIST "C:\Documents and Settings\All Users\Desktop\Quality Procedure Database.mdb" Goto end
pause
copy "E:\General\Quailty System\Quality System Procedures\Quality System Database\Quality Procedure Database.mdb" "C:\Documents and Settings\All Users\Desktop\" /y
pause

i even changed the location of the file from the network drive letter to the local drive, wait thats not going to work at all. It needs to be the I drive because this is running on their PC not the server. So, ok i'll put it back to the I drive. I do have this part of the logon.bat code after all the drives are maped.

Anyother thoughts?
 
does the "quality procedure database.mdb" actually exist? you mentioned that this was to be a shortcut not the actual file. Shouldn't the extension be: .lnk instead of .mdb?

if you go to a command prompt to that directory and do a "dir" command on it, do you see:

quality procedure.mdb

or

quality procdure.mdb.lnk
 
Hi,

I think its the spaces that are killing me. I can't CD into the directory. i go:

e: then
cd general then
cd quality system (i fixed the spelling) and it does not like it. I try using ""s and no luck.

Thoughts?

_ALEX
 
i'm afraid you've stumped me with that one. I recreated your directory structure on my D: and was able to CD with and without the quotes around the path. (step into each sub-directory one CD at a time and with the full path)

might be you could add the "command prompt here" context menu to your "my computer"/"explorer" with this:


then see if you can get to it that way and look for the file.
 
so in trying other things...

I went to my c drive and tried:
cd "program files
cd "c:\Program Files"

all kinds of stuff and it won't move over. This is on my XP laptop and Win2k server. really strange.

I'm chating with a guy in AIM, and he can do it no problem.

grrrrr
 
Two comments that may or may not help
1 - Does the user running the batch file have write access to the "All Users" directory?
2 - Have you tried using 8.3 names?
i.e. Program Files = Progra~1

 
uuu, thanks. your number 2 ~ thing works. Now i need to try in the logon.bat file. as for #1 i'm running it on my account which has full access.

Thanks oisnds,


_ALEX
 
so I had a long talk with my computers this morning. We basily came up with some sort of compromise and this is what I got to work:

IF EXIST "C:\Docume~1\All users\Desktop\QASyst~1.lnk" Goto end
copy "I:\Qualit~1\Qualit~1\Qualit~1\QASyst~1.lnk" "C:\Docume~1\All users\Desktop\" /y


yep, its a mix of the ~ thing and stuff with spaces. Since it started to work I decided to stop arguing with it. Kinda reminded me of my the conversation I had with the dog last night.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top