MSFN Forum: How to run this from a cmd file - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to run this from a cmd file How i can run this instruction from a batch file Rate Topic: -----

#1 User is offline   RTK999 

  • Newbie
  • Group: Members
  • Posts: 40
  • Joined: 08-December 07
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 08 December 2007 - 09:18 AM

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.

This post has been edited by RTK999: 08 December 2007 - 09:20 AM



#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,119
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 08 December 2007 - 07:54 PM

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.

#3 User is offline   RTK999 

  • Newbie
  • Group: Members
  • Posts: 40
  • Joined: 08-December 07
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 08 December 2007 - 10:13 PM

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.

#4 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,119
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 09 December 2007 - 07:28 AM

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.

#5 User is offline   RTK999 

  • Newbie
  • Group: Members
  • Posts: 40
  • Joined: 08-December 07
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 09 December 2007 - 01:25 PM

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

#6 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,119
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 09 December 2007 - 02:03 PM

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!

#7 User is offline   RTK999 

  • Newbie
  • Group: Members
  • Posts: 40
  • Joined: 08-December 07
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 09 December 2007 - 03:24 PM

ok thank a lot i'm starting and i learn its for myself

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy