Using relative paths

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
RBCC
Posts: 2
Joined: 10 Jan 2013 17:01

Using relative paths

#1 Post by RBCC » 10 Jan 2013 17:19

Hello all,

My name is John, I have a question about realitive path in Dos/windows 7. I have an app named "idiot" on the the dvd in the idiot directory, which will be copyied to the Windows\temp then it will be run. What is the relative path "command" to run this file ? Also I have three more files that help this file to run a.exe b.exe c.exe and they are on the dvd, in the and must be in the directory on the hard drive of the file "idiot". What relative path commands will copy it from the dvd to the right directory in the hard disk? Do I use the xcopy command in a batch file? Does it have a overwrite command? Thank you so very much, John :?: :D

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Using relative paths

#2 Post by abc0502 » 10 Jan 2013 17:53

At first, the temp directory will be "%temp%"
so the "idiot" application if it is copied to the temp directory with it's folder the path should be:

Code: Select all

"%temp%\idiot_folder\idiot.exe"

Now the 3 files if you want to copy them ONLY, then use the copy command:

Code: Select all

Copy /Y "DVD\folder\to\a.exe" >nul
Copy /Y "DVD\folder\to\b.exe" >nul
Copy /Y "DVD\folder\to\c.exe" >nul
Remove the /Y to prevent the overwrite.

I don't know if you want to copy the idiot application with it's folder to the temp directory or it will be copied and you just need to copy the 3 EXE files.
so this is how to copy a folder with it's content:

Code: Select all

XCopy "DVD\idiot_folder\*.*" "%temp%\idiot_folder" /Y /E /I
Remove the /Y to prevent the overwrite , and copying the EXE files is above.e EXE files is above.

The Batch Should be like this:

Code: Select all

@Echo OFF

:: Copy idiot application code under this line

:: Copy 3 EXE code under this line
 

Post Reply