XKnoppix Posted March 27, 2004 Share Posted March 27, 2004 Could someone post some sample code using XCOPY in RunOnceEx to copy over a file and/or directory please? When XCOPY copies a file does it remove read-only attributes? Thanks Link to comment Share on other sites More sharing options...
codeblue Posted March 27, 2004 Share Posted March 27, 2004 XKnoppix, i found this site very usefull when i need dos commands and switches, how it helps.Dos commandsxcopy /e /k /i /c /r /y "%CDROM%\Software\Favorites\"*.* "%systemdrive%\Documents and Settings\Administrator\Favorites\" Link to comment Share on other sites More sharing options...
XtremeMaC Posted March 27, 2004 Share Posted March 27, 2004 u don't really need websites to find the usagego into dos prompt type xcopy /?it will give u the instructions.if u want to read it later or have it on a notepad file or somethingtype xcopy /? >>xcopyhelp.txtthis will create a xcopyhelp.txt file for u to look over, print etc....xcopy normally resets the read only /hidden /system stuff so use /K to preserve the file attributes.also if u want to change the attributes on a file also in dos u can type attrib /? and see the list of commands on how to change it... Link to comment Share on other sites More sharing options...
Frank_Sechrist Posted March 27, 2004 Share Posted March 27, 2004 In RunOnceEx, you need to add 'cmd.exe /C' to the XCOPY command as follows:REG ADD %KEY%\075 /V 01 /D "cmd.exe /C\"XCOPY \"%CD%\NSW2003\MSDOS\*.*\" \"%allusersprofile%\Application Data\Symantec\Ghost\Template\Common\MSDOS\*.*\" /E /I /Q /H /R /Y\"\"" /f Link to comment Share on other sites More sharing options...
XKnoppix Posted March 28, 2004 Author Share Posted March 28, 2004 @Frank_SechristOkay I didn't understand one thing you said?!?I don't see those lines in anyone elses RunOnceEx.cmd file when they use XCOPY, what does it do?Thanks Link to comment Share on other sites More sharing options...
XtremeMaC Posted March 28, 2004 Share Posted March 28, 2004 well if u don't have anything looking like that in runonceex u're probably doing something else?reg add %key%\### /v 01 /D "etc etc etc " /f should definitely be there....post your cmd here... Link to comment Share on other sites More sharing options...
XKnoppix Posted March 28, 2004 Author Share Posted March 28, 2004 By the way could someone post some code for my RunOnceEx file?For example:%systemdrive%\install\Applications\CDRWIN\cdrwin.dat to C:\CDRWIN3\Thanks Link to comment Share on other sites More sharing options...
XKnoppix Posted March 28, 2004 Author Share Posted March 28, 2004 RunOnceEx.cmdcmdow @ /HID@echo offREG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v RunOnceEx /f >NULSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%\010 /VE /D "ATI Drivers" /fREG ADD %KEY%\010 /V 1 /D "%systemdrive%\install\Applications\ATI\Driver\Setup.exe -s -f1%systemdrive%\install\Applications\ATI\Driver\setup.iss" /fREG ADD %KEY%\020 /VE /D "ATI Control Panel" /fREG ADD %KEY%\020 /V 1 /D "%systemdrive%\install\Applications\ATI\Control\Setup.exe -s -f1%systemdrive%\install\Applications\ATI\Control\setup.iss" /fREG ADD %KEY%\030 /VE /D "Adobe Acrobat Reader" /fREG ADD %KEY%\030 /V 1 /D "%systemdrive%\install\Applications\AdobeReader6\AR6.msi /QN" /fREG ADD %KEY%\040 /VE /D "Microsoft .Net Framework" /fREG ADD %KEY%\040 /V 1 /D "%systemdrive%\install\Applications\NetFramework\netfx.msi /QN" /fREG ADD %KEY%\050 /VE /D "Nero Burning Rom" /fREG ADD %KEY%\050 /V 1 /D "REGEDIT /S %systemdrive%\install\Applications\Nero\register.reg" /fREG ADD %KEY%\050 /V 2 /D "%systemdrive%\install\Applications\Nero\Nero6009.exe /no_ui /silent /noreboot" /fREG ADD %KEY%\060 /VE /D "Windows Media Player 9" /fREG ADD %KEY%\060 /V 1 /D "%systemdrive%\install\Applications\WMP9\MPSetupXP.exe /Q:A /R:N" /fREG ADD %KEY%\070 /VE /D "Registering Video Codecs" /fREG ADD %KEY%\070 /V 1 /D "regsvr32.exe %systemroot%\system32\xvid.ax /s" /fREG ADD %KEY%\070 /V 2 /D "regsvr32.exe %systemroot%\system32\divxdec.ax /s" /fREG ADD %KEY%\070 /V 3 /D "regsvr32.exe %systemroot%\system32\ac3filter.ax /s" /fREG ADD %KEY%\080 /VE /D "Registering mIRC" /fREG ADD %KEY%\080 /V 1 /D "REGEDIT /S %systemdrive%\install\Applications\mIRC\register.reg" /fREG ADD %KEY%\090 /VE /D "MSN Messenger 6.1" /fREG ADD %KEY%\090 /V 1 /D "%systemdrive%\install\Applications\MSN\MsnMsgs.msi /QN" /fREG ADD %KEY%\100 /VE /D "WinRAR 3.30" /fREG ADD %KEY%\100 /V 1 /D "%systemdrive%\install\Applications\WinRAR\wrar330.exe /s" /fREG ADD %KEY%\110 /VE /D "Hauppauge WinTV Drivers" /fREG ADD %KEY%\110 /V 1 /D "%systemdrive%\install\Applications\WinTV\whql337_21163.exe /s" /fREG ADD %KEY%\110 /V 2 /D "taskkill.exe /F /IM whql337_21163.exe" /fREG ADD %KEY%\120 /VE /D "CDRWIN 3.9f" /fREG ADD %KEY%\120 /V 1 /D "%systemdrive%\install\Applications\CDRWIN\cdrwin.exe /s" /fREG ADD %KEY%\130 /VE /D "**** NFO Viewer" /fREG ADD %KEY%\130 /V 1 /D "%systemdrive%\install\Applications\****\****.msi /QN" /fREG ADD %KEY%\140 /VE /D "Longhorn Transformation Pack" /fREG ADD %KEY%\140 /V 1 /D "%systemdrive%\install\Applications\Longhorn\Longhorn Transformation Pack.exe /s" /fREG ADD %KEY%\140 /V 2 /D "taskkill.exe /F /IM Longhorn Transformation Pack.exe" /fREG ADD %KEY%\150 /VE /D "Applying Registry Tweaks" /fREG ADD %KEY%\150 /V 1 /D "REGEDIT /S %systemdrive%\install\RegTweaks.reg" /fREG ADD %KEY%\160 /VE /D "Enabling Windows File Protection" /fREG ADD %KEY%\160 /V 1 /D "REGEDIT /S %systemdrive%\install\Applications\Longhorn\wfp.reg" /fREG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Run /V Cleanup /D "%systemdrive%\cleanup.cmd"EXIT Link to comment Share on other sites More sharing options...
XtremeMaC Posted March 28, 2004 Share Posted March 28, 2004 (edited) hmm well that's wierd u just need to add this to any part of that cmd file???REG ADD %KEY%\170 /VE /D "copy" /fREG ADD %KEY%\170 /V 1 /D "cmd.exe /C\"XCOPY \"%CD%\NSW2003\MSDOS\*.*\" \"%allusersprofile%\Application Data\Symantec\Ghost\Template\Common\MSDOS\*.*\" /E /I /Q /H /R /Y\"\"" /fand for the other question u want cdrwin.dat to be copied to C:\CDRWIN3\ ? rightthat u can just do with copy copy cdrwin.dat c:\cdrwin3\REG ADD %KEY%\180 /VE /D "copy2 " /fREG ADD %KEY%\180 /V 1 /D "cmd.exe /C\"COPY \"%CD%\cdrwin.dat\" \"c:\cdrwin3\\" \\"\"" /fsomething like that but i see u have not set the %cd% path in there u've to do that.i really have to go now, i saw the pm at the last second...later... Edited March 28, 2004 by XtremeMaC Link to comment Share on other sites More sharing options...
XKnoppix Posted March 28, 2004 Author Share Posted March 28, 2004 I still don't get what these lines do? REG ADD %KEY%\170 /VE /D "copy" /fREG ADD %KEY%\170 /V 1 /D "cmd.exe /C\"XCOPY \"%CD%\NSW2003\MSDOS\*.*\" \"%allusersprofile%\Application Data\Symantec\Ghost\Template\Common\MSDOS\*.*\" /E /I /Q /H /R /Y\"\"" /fI don't even have a "%allusersprofile%\Application Data\Symantec\Ghost\Template\Common\MSDOS\ dir on my CD?! Could you explain? Plus if i figure this out i'm going to use XCOPY to replace $Progs and $Docs for read-only error reasons Thanks Link to comment Share on other sites More sharing options...
Alanoll Posted March 28, 2004 Share Posted March 28, 2004 i believe that was an example from someone's runonce file shoing you how to use it.the reasoning behind cmd.exe /C is that XCOPY is a MSDOS command that can only be used form the command promp. cmd.exe /C sends a line of batch code to the command interpreter. It'd be like creating a batch file, but this is only doing one line instead of creating a whole nother file.Everything after that is the command you want to run...%CD% is current directory. You may wish to change that to reflect what you want to do.%allusersprofile% is a variable pointing to the C:\Documents and Settings\All Users\ directory on your harddrive. XCOPY usage is...XCOPY (file/directory to copy from) (file directory to copy to)for what the switches mean, open a command prompt and type XCOPY /? and it will tell you everything. Link to comment Share on other sites More sharing options...
Frank_Sechrist Posted March 28, 2004 Share Posted March 28, 2004 REG ADD %KEY%\170 /VE /D "copy" /fREG ADD %KEY%\170 /V 1 /D "cmd.exe /C\"XCOPY \"%CD%\NSW2003\MSDOS\*.*\" \"%allusersprofile%\Application Data\Symantec\Ghost\Template\Common\MSDOS\*.*\" /E /I /Q /H /R /Y\"\"" /fI used the Symantec\Ghost XCOPY as an example. You would have to change the path and file or folder name to suit your situation.You originally asked how to run XCOPY from RunOnceEx. You have to add the cmd.exe /C in order to do that. Alternatively, you can run XCOPY without the cmd.exe /C from a .cmd file, and call that .cmd file from RunOnceEx. Link to comment Share on other sites More sharing options...
XKnoppix Posted March 28, 2004 Author Share Posted March 28, 2004 How do i implement %CD% variable for multiple restarts, because for some reason when it restarts the %CD% variable is deleted?! Link to comment Share on other sites More sharing options...
Alanoll Posted March 28, 2004 Share Posted March 28, 2004 don't?%CD% is Current Directory...Everything else in your batch has %systemdrive% in it. Just use it instead. You don't have to use everything everyone else uses in your batch. Link to comment Share on other sites More sharing options...
XKnoppix Posted March 28, 2004 Author Share Posted March 28, 2004 Oh I ment to say %CDROM% Isn't it a variable for the CD-ROM and would allow me to run files straight offf the cd rather than copying them to Hard Drive?ThanksP.S. Remember "multiple boots" 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