0

Hi Im new with CMD but I'd like to make a few scripts to make my gaming a little easier this might help also in the future.

So I have my code here

xcopy /s "D:\MSC\Amistech" "%USERPROFILE%\AppData\LocalLow\Amistech" /Y

This works fine for my brothers Laptop but plugging it into my computer gives my USB (D:) (Volume name "120GB") drive a different letter which causes It not to work on other peoples computer I'd like to have it change from the D: drive to auto detect when opened what drive the batch file is opened on but I have no idea where to start.

meowmeow
  • 13
  • 2
  • 2
    I believe you can just leave out the drive letter: "\MSC\Amistech". This will start from the root directory of whatever disk the batch file was run. – 001 Jun 26 '17 at 00:17
  • @JohnnyMopp, leaving out the drive letter takes the drive of the *current working directory*, which is not the same as the drive and directory where the batch file is located; using `%~d0` in the batch file points to the drive containing the batch file... – aschipfl Jun 26 '17 at 14:58

1 Answers1

0

%~d0 wil give you the drive from where the batch is started

%~dp0 the complete path.

%cd% will give you the path where the program is actually in

SachaDee
  • 9,245
  • 3
  • 23
  • 33