Jump to content

Recommended Posts

Posted (edited)

Hi i have this problem how i can run this instruction from a cmd file:

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:

SET PP=%CDROM%\Software\

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\005 /VE /D "Test" /f

REG ADD %KEY%\005 /V 1 /D "CMD.exe /C XCOPY \"%PP%Ztest\Data\" \"%SYSTEMDRIVE%\Ztest\Data\" /E /Y /I" /f

so i want this:

a cmd file that contain this instruction XCOPY "Data" "%SYSTEMDRIVE%\Ztest\Data\" /E /Y /I ,to copy those files and call in runonceex.cmd so:

REG ADD %KEY%\005 /VE /D "Test" /f

REG ADD %KEY%\005 /V 1 /D "%PP%Ztest\test.cmd" /f

i dont want a SFX archive. that is my last option but i would like a cmd file instead of calling in the same runonceex.

Edited by RTK999

Posted

I have removed the identical posting you've made on this subject from the Windows XP Forum area. Please do not make multiple posts with identical content.

As for your topic, could you please try to explain better what you are trying to do. You appear to have both asked a question and answered it in the same post. If there is something which is not working then tell us what it is you've done and what the result is so that we are better equipped to help you.

Posted

sorry for my first post i didnt wanna make it that just i wrote the first post in a wrong forum.

The question is :

I want to run the xcopy command from a batch file and then call the batch file from RunOnceEx.

The problem is that i dont make the xcopy command work in th batch file i tried everything but nothing happened.

I dont want to run the xcopy command from the RunOnceEx file.

Posted

This command inside your NT Command Script should work fine.

XCOPY Data %SYSTEMDRIVE%\Ztest\Data /E/Y/I

.

From the code you've provided it does appear that your Data folder is in the correct location in relation to the script and your runonceex command line appears to be correct.

Try changing the command line to that which I've provided and report back with your results.

Posted

Well its work fine know i put this in my batch file:


@echo off

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:

SET PP=%CDROM%\Software\

XCOPY %PP%\Aimp2\Data /E /I /Y "%SYSTEMDRIVE%\Archivos de programa\AIMP2\Data\"

EXIT

and then call it from my Runonceex from cd:


@Echo Off

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:

SET PP=%CDROM%\Software\

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Softwares List" /f

REG ADD %KEY%\001 /VE /D "Start..." /f

REG ADD %KEY%\005 /VE /D "Aimp2" /f
REG ADD %KEY%\005 /V 1 /D "%PP%Aimp2\test.cmd" /f

EXIT

thanks Yzöwl for support, this is a bit more work but is more ordered the runonceex

Posted

I'm glad you've got it sorted.

Try to learn to optimize your code a little too!

e.g.

@echo off
FOR %%i IN (
D E F G H I J K L M N O P Q R S T U V W X Y Z
) DO IF EXIST %%i:\CD.txt SET "PP=%%i:\Software\Aimp2\Data"
XCOPY %PP% "%PROGRAMFILES%\AIMP2\Data" /E/I/Y

As you can see, since you weren't actually using %CDROM% you didn't need to create it as a variable!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...