Need Some Help Scripting

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
HAA
Posts: 1
Joined: 06 Feb 2014 11:06

Need Some Help Scripting

#1 Post by HAA » 06 Feb 2014 11:14

I am trying to create a Batch file that will Show the Drive letters allow a User to Press What drive Letter they are wanting to use, And then Give A menu. Option one to Transfer data To hard Drive, Option 2 Transfer Data From HDD. I need it to show a progress when transfering data From the HDD to The Storage Server Any Ideas on how to get this done.
Here is A sample of what i have done so far

Code: Select all

echo.
echo.= Menu =================================================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo.  %%B  %%C
set choice=
echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP

::-----------------------------------------------------------
:: menu functions follow below here
::-----------------------------------------------------------

:menu_1   Push Data To HDD From Workstation
@echo off
mkdir C:\USMT
xcopy "\\hmmfile03\user software$\usmt" "C:\USMT" /e /i /h
Cd C:\USMT\X86
MD e:\UserData\%computername%
C:\USMT\X86\scanstate.exe E:\UserData\%computername% /o /i:migapp.xml /i:miguser.xml /i:pst.xml
Pause
GOTO:EOF

:menu_2   Push Data From HDD to \\HMMStor01\Userdata
echo.Get a water and then add some code right here
GOTO:EOF

:menu_

:menu_T   Tip
echo.It's easy to add a line separator using one or more fake labels
GOTO:EOF

:menu_C   Clear Screen
cls
GOTO:EOF


So I need to beable to change drive letter E: To what ever drive the USB HDD is going to be... Any IDEAS.. :?:

Matt Williamson
Posts: 82
Joined: 30 Dec 2013 10:16
Location: United States by the big waterfall

Re: Need Some Help Scripting

#2 Post by Matt Williamson » 06 Feb 2014 13:27

You can use WMIC to get the volumeserialnumber and code it to use that.

wmic logicaldisk get VolumeSerialNumber,Name,drivetype,access,description

Then use:

Code: Select all

for /f %%d in ('wmic logicaldisk where "VolumeSerialNumber=theserial" get name^|find ":"') DO (
    SET "curDrive=%%d"
)

Then use %curDrive% in place of E:

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need Some Help Scripting

#3 Post by foxidrive » 06 Feb 2014 20:34

There is no progress indicator for a command-line copy command except when using Xcopy over a network with the /Z switch.

But you can check robocopy to see if it has a progress indicator, too.

Post Reply