Question Locked

ROOT- File List via USB Flash Drive

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

GOAL: Execute a COMMAND.CMD via Flash drive and make this Flash Drive the destination of the COMMAND.CMD.

PROGRESS: With success, I?m able to use ROBOCOPY with Log Option and save that Log on the Flash Drive.

Here?s the CMD that I?m using:
ROBOCOPY C:\ C:\xfolder /MIR /XA:SH /XJD /R:1 /W:2 /ETA /X /FP /LOG:xfile.log
(Usually more specific with a Source)

Here?s the Autorun.inf that I?m using:
[autorun]
icon=my.ico.
label=Gathering
open=gatherbkup.cmd
action=Back List
shell\open\command=gatherbkup.cmd

Here?s my question:
I?m using this file via Flash Drive, if I wanted the CMD to put files on this Flash Drive, How would I tell the CMD to do so?

8 replies

by seanferd

If it is the log you are concerned with, you should be able to specify a path for the logfile, rather than just filename. You can also redirect the logfile output.

If the problem is that the flash drive may not always be assigned the same drive letter, use /NODD. The destination can be specified at run time.

by rob miners

@echo off
set path=%~dp0;%path%
Robocopy C:\Users\Rob %~dp0\TheBackup /MIR /XA:SH /XD AppData /XJD /R:5 /W:15

by kbeelitz

set path=%~dp0;%path% works like a charm! In my cmd file I had to take out the @echo off line. With it, the file would not work, without it, the files works perfectly.

THANKS!

by rob miners

%~dp0; resolves to the fully expanded path to the directory containing the batch file. This allows batch files to run regardless of the current working directory.

Command-line reference A-Z
http://technet.microsoft.com/en-au/library/bb491071.aspx

Batch Files & MS-DOS Commands
http://www.robvanderwoude.com/booksbat.php

Check out DOS Secrets
http://www.mdgx.com/

Keep us informed as to your progress if you require further assistance.


If you think that any of the posts that have been made by all TR Members, have solved or contributed to solving the problem, please Mark them as Helpful so that others may benefit from the outcome. ;) :D

by rob miners

It's good to see someone with an interest in DOS. It's still very powerful and there is a lot that you can do from the command line. Good Luck.

This discussion is closed to new replies.