SS64 Discussion Forum

You are not logged in.

#1 2009-10-27 18:06:37

cgman
8088
Registered: 2009-02-15
Posts: 27

copying files without using drive names

I have been working with this project that uses WinPE and, for the most part, it's based on disk/partition/volume names.
I need to copy a lot of files to the constant disk 1 instead of using the E: drive, which could change. 

disk 1 will always be the flash drive that i am trying to partition, make bootable and copy boot files to. 

is there any way to use xcopy or robocopy with disk names, rather than drive names?
I am trying to avoide using: xcopy c: d: and use something that allows xcopy disk0 volume1 disk1 volume 1

Thanks,

cgman

wall

Offline

#2 2009-10-28 23:35:31

NDog
PDP-11
From: New Zealand
Registered: 2006-05-31
Posts: 70
Website

Re: copying files without using drive names

I use a program called fsync ->http://www.vicobiscotti.it/en/fsync.htm which performs one way synchronization between my laptop (source) and usb (destination).

On my usb drive there is a unique folder DOWNLOAD and on the laptop ~USB in the root folder. The script parses all drive letters and searches for the unique folder names and if it find them sets a variable for that letter.

Maybe you could play with a similar idea as this one for your winPE scripts?

@echo off&cls
title=%~n0

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:\~USB        SET _laptop=%%I:\~USB
    IF EXIST %%I:\DOWNLOAD    SET _ns3=%%I:
    )

echo. > fsync.log

    fsync "%_laptop%\ns3" "%_ns3%\ns3" /F /L3+
    fsync "%_laptop%\personal\zUser\Scripts" "%_ns3%\scripts" /F /D /L3+

    shutdown -s -f -t 60 -c "Finished Synchronization"

Known Scripting Languages: CMD, Autoit, 4DOS

Offline

#3 2010-01-11 21:27:44

Drewfus
8088
From: Australia
Registered: 2010-01-10
Posts: 31

Re: copying files without using drive names

Hi cgman.
Try this;

@echo off
setlocal
for /F "tokens=3" %%A in ('dosdev -a ^| findstr /B "Harddisk1Partition1"') do set SymLink=%%A
endlocal & for /F %%A in ('dosdev ^| find "%SymLink%"') do set DL=%%A
if defined DL (echo Variable DL defined. Value is: %DL%) else (
echo Error setting variable.
)

Get dosdev.exe from this download;

Microsoft Product Support Reports

Offline

Board footer

Powered by FluxBB