mintel Posted March 23, 2005 Share Posted March 23, 2005 Ive got a question. Is it possible to run a command (a *.cmd file) befor windows logs on (before the log on screen)?I want to do this, because i want to run a copy command of the document and settings directory, but that is not possible if a user is logged on Does anybody know how i can do this? Or has an alternative?Thanx in advance! Link to comment Share on other sites More sharing options...
Honnes Posted March 23, 2005 Share Posted March 23, 2005 Hmm...i think the following would do the trick:Log on to the computer.Go to START/RUN and type "cmd" (without "")Go to your root dir (on which windows resides) (C: for example)Type CD\ (so you'll be on the very root of the HD)Type 'edit autoexec.bat' (loading edit can take a couple of seconds...). If autoexec.bat has lines in it, be carefull that you not edit stuff (which does belong in autoexec.bat)Put the following line somewhere in your file:xcopy c:\DOCUME~1\*.* /D /E /H x:\destinationx:\destination is your complete path to the dir where the backup has to be placed. You have to work in 8.3 Dos format. This means that when a foldername is longer dan 8 chars, then you'll have to write down the first 6 chars + ~1 (if there are more folders with the same 6 chars, then you'll have to number ~x on alphabet). If the folder name is exactly 8 chars, then you don't have to change destination folder (spaces are not allowed @ dos).I hope you'll understand what i've said and well, if u need help, i'll try to help Link to comment Share on other sites More sharing options...
mintel Posted March 23, 2005 Author Share Posted March 23, 2005 Thanx!The problem is. It's Windows 2000. They replaced CONFIG.SYS and AUTOEXEC.BAT with CONFIG.NT and AUTOEXEC.NT.So I tryed to place the following line in the AUTOEXEC.NT:xcopy %SYSTEMROOT%\TempDocs\*.* %SYSTEMDRIVE%\Docume~1\*.* /S /E /I /Q /H /YIt didn't run my command nor a give me an error. Any other suggestions ?Or should i try to place the above code in AUTOEXEC.BAT and place an line in AUOTEXEC.NT to run AUTOEXEC.BAT ?THANX IN ADVANCE! Link to comment Share on other sites More sharing options...
MCT Posted March 23, 2005 Share Posted March 23, 2005 im not really familar with win2k..but u need quotes around your statement.. so windows picks up spaces (if there are any) in your files xcopy "%SYSTEMROOT%\TempDocs\*.*" "%USERPROFILE%\" /S /E /I /Q /H /Y Link to comment Share on other sites More sharing options...
Honnes Posted March 23, 2005 Share Posted March 23, 2005 Im running win2k here too and well, i don't have a autoexec.nt or what so ever, but i do have autoexec.bat, config.sys and so on. It are hidden files, thats also why i forwarded you to autoexec.bat via CMD.By the way, your xcopy command switches are a bit strange.../H == copy hidden/E == copys folder, even when they're empty/S == Copy folders when they're not empty (/E and /S are working against eachother)/I == Target is a folder when target does not exist, remove this one too.../Q == Dont show copied files..okay./Y == Overwrite files without prompting..okay.I would prefer this:xcopy %SYSTEMROOT%\TempDocs\*.* %SYSTEMDRIVE%\Docume~1\ /E /I /Q /H /YI also removed the *.* at the end of docume~1 cause if you do that, you DO have to 'tell' the comp what the destination is (file or folder)I think that %SYSTEMROOT% and %SYSTEMDRIVE% doesnt work, cause that is loaded via config.sys and .PATH commands of autoexec.batgood luck ;-) Link to comment Share on other sites More sharing options...
valter Posted March 23, 2005 Share Posted March 23, 2005 íf you have another computer, use admin share c$ and copy what ever you want ... Link to comment Share on other sites More sharing options...
mintel Posted March 23, 2005 Author Share Posted March 23, 2005 Ok, this is what i'm going to try.I'm making an Unattended Windows 2000 install cd.Ive got everyting set, except for the Documents and Settings directory.The problem is that the Documents and settings dir is nog copied during the setup.(XP copies the $docs dir and W2K not)I'm trying to resolve this problem by copying the Docs dir BEFORE windows loads, or just before a user logs in (Administrator of some one else)You can read in the reply's above that i tried to copy the Docs dir via AUTOEXEC.NT, but doesn't work (AUTOEXEC.NT only defines thet MS-DOS environment, does not run programs from what i read in other sites)I also tried to use the AutoExNT tool from the ResourceKit (It runs a service on the computer and then from there it will run a batch file with commands, the trick is this runs before any user logs on. But my experience is that it runs AFTER a user logs on (and then the Docs dir is locked ) Thanx microsoft! NOT! (How to Run a Batch File Before Logging on to Your ComputerAnd now i'm stuck. This is the only thing that's not done, after this, the CD is finished.Any help is welcome, and Thanx in Advance! Link to comment Share on other sites More sharing options...
prathapml Posted March 23, 2005 Share Posted March 23, 2005 Is it possible to run a command (a *.cmd file) befor windows logs on (before the log on screen)?Does anybody know how i can do this? Or has an alternative?<{POST_SNAPBACK}>1. Easy - Copy files over to "%systemdrive%\Docs&Settings\Default User" folder itself, thru cmdlines.txt (T-12) and whatever new users are created will inherit those files.2. This one is a bit less easy - There is a registry key that can run something just before login. Find this in the registry tweaks thread (in "unattended windows" section of this forum). And then set it and remove on next boot and manipulate it as you please. Link to comment Share on other sites More sharing options...
mintel Posted March 24, 2005 Author Share Posted March 24, 2005 Is it possible to run a command (a *.cmd file) befor windows logs on (before the log on screen)?Does anybody know how i can do this? Or has an alternative?<{POST_SNAPBACK}>1. Easy - Copy files over to "%systemdrive%\Docs&Settings\Default User" folder itself, thru cmdlines.txt (T-12) and whatever new users are created will inherit those files.2. This one is a bit less easy - There is a registry key that can run something just before login. Find this in the registry tweaks thread (in "unattended windows" section of this forum). And then set it and remove on next boot and manipulate it as you please.<{POST_SNAPBACK}>1. Em, I already tried to run that command from the cmdlines (T-12) file, but that didn't work. Both the Xcopy nor the copy command didn't work. I also dit not use variables (maybe they were not defined in this stage of the setup, so just to be sure i used the full path names)Or should i place those commands in an batch or an command file, ant then run that file from the cmdlines (T-12) file ? 2. I searched the 'Unattended Windows' section for that registry entry, without succes (that's why i'm wrighting this reply )I also searched the topic 'Reg tweaks' and 'Reg tweaks part 1', but without succes.I also downloaded both the Regtweaks zip files, and searched in there. but that also wasn't rewarding (Does anybody know what the regtweak is or where (exactly) i can find it.Thanx in advance (again!) Link to comment Share on other sites More sharing options...
Br4tt3 Posted March 24, 2005 Share Posted March 24, 2005 Dunno but u can try to see if there is something under the local policies where it would run scripts during comp startup.. dunno if this is limited to corp installations where xp / 2000 interacts with a DC but check it out..perhaps.. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MSConfig\startupfolder]then again, dont think this is present during initial installation of the Win32 os.keep truckin.. Link to comment Share on other sites More sharing options...
mintel Posted March 24, 2005 Author Share Posted March 24, 2005 Dunno but u can try to see if there is something under the local policies where it would run scripts during comp startup.. dunno if this is limited to corp installations where xp / 2000 interacts with a DC but check it out..perhaps.. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MSConfig\startupfolder]then again, dont think this is present during initial installation of the Win32 os.keep truckin..<{POST_SNAPBACK}>Nope i checked in win2k registry for that key, but it doesn't exist. But thanx anyway! Link to comment Share on other sites More sharing options...
prathapml Posted March 25, 2005 Share Posted March 25, 2005 1. Em, I already tried to run that command from the cmdlines (T-12) file, but that didn't work. Both the Xcopy nor the copy command didn't work. I also dit not use variables (maybe they were not defined in this stage of the setup, so just to be sure i used the full path names)<{POST_SNAPBACK}>Well, I always recommend using variables. That will work, or maybe you got a spelling error in your commands previously. Or if commands in a batch-file is not working for you, use RAR SFX to extract silently to a known path. If you need more info about that, just ask. Link to comment Share on other sites More sharing options...
mintel Posted March 29, 2005 Author Share Posted March 29, 2005 1. Em, I already tried to run that command from the cmdlines (T-12) file, but that didn't work. Both the Xcopy nor the copy command didn't work. I also dit not use variables (maybe they were not defined in this stage of the setup, so just to be sure i used the full path names)<{POST_SNAPBACK}>Well, I always recommend using variables. That will work, or maybe you got a spelling error in your commands previously. Or if commands in a batch-file is not working for you, use RAR SFX to extract silently to a known path. If you need more info about that, just ask. <{POST_SNAPBACK}>Well i tried what you said, but it didn't work I packed the directory (All users and Default User) in a SFX in DOS modi.The script whithin in the file is as follows:Path=c:\docume~1\SavePathSilent=1Overwrite=1And my cmdlines.txt is as follows:[COMMANDS]"REG IMPORT HKCU_Reg.reg""Docs.exe"I also placed the "Docs.exe" in the $OEM$ folder (where also the Docs.exe is placed)What the *** am i doing wrong Thanx again for all your reply's! Link to comment Share on other sites More sharing options...
os2fan2 Posted March 31, 2005 Share Posted March 31, 2005 Proggie called 'autoexecnt.exe' is what you're looking for.zb http://www.jsiinc.com/dl/autoexnt.zip Link to comment Share on other sites More sharing options...
mintel Posted March 31, 2005 Author Share Posted March 31, 2005 ...I also tried to use the AutoExNT tool from the ResourceKit (It runs a service on the computer and then from there it will run a batch file with commands, the trick is this runs before any user logs on. But my experience is that it runs AFTER a user logs on (and then the Docs dir is locked ) Thanx microsoft! NOT! (How to Run a Batch File Before Logging on to Your Computer...<{POST_SNAPBACK}>Thanx os2fan2, but i already tried that option, but it doesn't work. It runs after the user logs on, instead of before...But thanx again for the reply Link to comment Share on other sites More sharing options...
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