XCOPY Prompt

B

Bob Hatch

I probably would have written the header like this:

cls
echo off
echo This program will backup jpg pics from Drive D to Marys Drive D.
pause



What does the following code block do?
d:
cd pictures
U:
cd Pictures

Why not replace 6 lines of code (the 4 I asked about plus the next
two) with a single fully qualified xcopy command?

Just curious. :)
I use the same batch file to back up things from friends computers. It's
easier to change the simple commands you asked about rather than type in
a longer file name for source and destination. At least it is for me. :)
 
C

choro

On 25/04/2012 02:39, Char Jackson wrote:

On 24/04/2012 17:51, Gene Wirchenko wrote:
On 4/23/2012 2:18 PM, Gene Wirchenko wrote:
Dear Win7ers:

I am working between two systems: an XP system and a 7 system. I
copy files back and forth on a USB stick. Some of the filenames are
long, and I have old utility software that is limited to the 8.3 file
format. I need short filenames, and I can not trust the the short
names generated by Windows will be consistent.

I created a batch file to make a short filename version:
del WFCNew.asp
xcopy WorkFunctionCodes_New.asp WFCNew.asp /v
^1^^^^^^^^^^^^^^^^^^^^^^^ ^2^^^^^^^^
1 is the source; 2 is the destination.

[snip]

I don't see a source and/or destination in your batch file.

If the file is already on the USB stick, why don't use just use ren or
rename?

I want a copy with a different name.

The simplest way is to copy and paste the file to another folder, rename
it there and then drag and drop it to the original folder. IF they are
in different drives then use the CUT& PASTE method.If you want both
copies of the file in the same folder that is...

Remember the motto, *Keep it simple*.

There's nothing "simple" about all of that rigmarole. I fail to see
the reason, and I fail to see why it would be any easier, to rename
files in one folder versus another. Just rename them where they lie.

But I thought he wanted *two* copies of the same file under different
names. Hence my suggestion... Got it?!

That's where xcopy (and copy, etc.) come in. They do exactly that, but
without requiring you to move files somewhere else first.

Otherwise you can rename a file in loco as you suggest. But you cannot
rename a file in loco and still retain the old version with the old
original filename.

That's where xcopy (and copy, etc.) come in. They do exactly that, but
without requiring you to move files somewhere else first.

I sound like a broken record, but these kinds of basic file operations
are, well, basic. They've been with us for over 30 years now.
No need for xcopy at all. Just open the file, *Save as...* and give it a
different filename -- may I suggest a dash or an underscore just before
the dot and the file extension e.g. Filename-.doc or Filename_.doc And
it's done! And you have 2 copies in the same folder.
There's no need to open any files. You seem to have a knack for coming
up with convoluted solutions. :)

It is *YOU* who keeps coming up with convoluted solutions to the
simplest of procedures.

Anyway, this thing about having two copies of the same file in the same
folder but under different names is about the stupidest thing that I
have ever come across in the field of computing.
-- choro
 
C

Char Jackson

It is *YOU* who keeps coming up with convoluted solutions to the
simplest of procedures.
Really? I'm pretty sure it was you who suggested moving the files to
another directory, renaming them there, and then moving the renamed
files back, versus simply renaming the files where they happened to
be. I'm also pretty sure it was you who suggested opening the files in
their native application and saving them with a new name. Both of
those solutions pale in comparison to simply renaming the files, in
this case via the xcopy command. Am I missing something?
Anyway, this thing about having two copies of the same file in the same
folder but under different names is about the stupidest thing that I
have ever come across in the field of computing.
People often label something stupid (or worse) until they understand
it. If you think about it a bit, I'm sure you'll see that it's
completely valid.
 
S

Steve Hayes

The file is on, what Windows calls, the desktop. Click on the batch file
and away we go. :)
I don't put anything on the desktop except icons that are shortcuts to
programs elsewhere. The main reason is that I can't find the desktop to edit
the files.

I keep all my .BATs in C:\belfry, have C:\belfry in the path, so click on the
command line icon on the desktop, type the name of the batch file, and it
works.

DR-DOS had some useful commands like XDEL, which worked in Windows 98, but
doesn't seem to work in XP or later.
 
C

Char Jackson

I don't put anything on the desktop except icons that are shortcuts to
programs elsewhere. The main reason is that I can't find the desktop to edit
the files.
I had one of those "Huh??" moments when I read that. :)
 
C

choro

Really? I'm pretty sure it was you who suggested moving the files to
another directory, renaming them there, and then moving the renamed
files back, versus simply renaming the files where they happened to
be. I'm also pretty sure it was you who suggested opening the files in
their native application and saving them with a new name. Both of
those solutions pale in comparison to simply renaming the files, in
this case via the xcopy command. Am I missing something?


People often label something stupid (or worse) until they understand
it. If you think about it a bit, I'm sure you'll see that it's
completely valid.
Well, it's either I or you who has got it wrong. But FYI here is what
Witcherenko write...

I want a copy with a different name.

Sincerely,

Gene Wirchenko

i.e. he wants a copy of the file under a different name (and in the same
folder...OR do you want me to quote him about that also?

How can you rename a file in its native folder and still retain the file
with the old filename?

I wonder whether it is I or you who misread him?
-- choro
 
Z

Zaphod Beeblebrox

On Fri, 27 Apr 2012 07:54:04 +0200, "Steve Hayes"
I don't put anything on the desktop except icons that are shortcuts to
programs elsewhere. The main reason is that I can't find the desktop to edit
the files.

I keep all my .BATs in C:\belfry, have C:\belfry in the path, so click on the
command line icon on the desktop, type the name of the batch file, and it
works.

DR-DOS had some useful commands like XDEL, which worked in Windows 98, but
doesn't seem to work in XP or later.
Since no one has yet pointed you to the location of the desktop, it can
be found in %userprofile%\desktop on most Windows systems (you can
configure things so that it is elsewhere, but that's pretty uncommon.)
In Windows 7 that ends up being C:\Users\<username>\desktop for a
standard setup.

FYI
 
B

Bob Hatch

I don't put anything on the desktop except icons that are shortcuts to
programs elsewhere. The main reason is that I can't find the desktop to edit
the files.
If it's a batch file, right click, select edit.
 
C

Char Jackson

Well, it's either I or you who has got it wrong. But FYI here is what
Witcherenko write...

I want a copy with a different name.

Sincerely,

Gene Wirchenko

i.e. he wants a copy of the file under a different name (and in the same
folder...OR do you want me to quote him about that also?
Yep, that's what he wants. I don't see a problem with it.
How can you rename a file in its native folder and still retain the file
with the old filename?
By using the copy command, or one of its variants such as xcopy.
I wonder whether it is I or you who misread him?
You probably know the answer to that by now. ;-)
 
G

Gene E. Bloch

I don't put anything on the desktop except icons that are shortcuts to
programs elsewhere. The main reason is that I can't find the desktop to edit
the files.
The desktop is very hard - really impossible - to miss. I completely
fail to understand what you mean.

Or are you trying to say you can't open it as a folder in Windows
Explorer? My remark above still applies, but try these two methods:

1. Open Explorer. Click on C: in the left pane (the Navigation Pane).
Then in the Right Pane (the File Pane), double click on Users and then
your username. Finally double click on Desktop, also in the right pane.

2. Click on the Start Orb and enter shell:desktop in the search box.
Press Enter.

And others have also given useful suggestions in this subthread.
 
S

Steve Hayes

If it's a batch file, right click, select edit.
That will not edit it in the program I want to edit it in nor will it tell me
the path to put in the batch file to copy it to the flash drive.

copy c:\desktop\desktop J: just doesn't work.

The desktop doesn't tell me the path to itself.
 
C

Char Jackson

That will not edit it in the program I want to edit it in nor will it tell me
the path to put in the batch file to copy it to the flash drive.

copy c:\desktop\desktop J: just doesn't work.

The desktop doesn't tell me the path to itself.
As someone (Zaphod?) posted earlier in this thread, the path is
%userprofile%\desktop. Or, you can always use the fully qualified
path, if that's easier. Either way, it's not exactly a secret or
hidden in any way.
 
B

Bob Hatch

As someone (Zaphod?) posted earlier in this thread, the path is
%userprofile%\desktop. Or, you can always use the fully qualified
path, if that's easier. Either way, it's not exactly a secret or
hidden in any way.
:)
 
S

Steve Hayes

As someone (Zaphod?) posted earlier in this thread, the path is
%userprofile%\desktop. Or, you can always use the fully qualified
path, if that's easier. Either way, it's not exactly a secret or
hidden in any way.
It may not be secret or hidden but it's bloody hard to find.

C:\Documents and Settings\Steve>dir c:\%steve%\desktop
The system cannot find the file specified.

C:\Documents and Settings\Steve>dir c:\%Steve%\desktop
The system cannot find the file specified.

C:\Documents and Settings\Steve>dir c:\Steve\desktop
The system cannot find the file specified.
 
C

Char Jackson

It may not be secret or hidden but it's bloody hard to find.

C:\Documents and Settings\Steve>dir c:\%steve%\desktop
The system cannot find the file specified.

C:\Documents and Settings\Steve>dir c:\%Steve%\desktop
The system cannot find the file specified.

C:\Documents and Settings\Steve>dir c:\Steve\desktop
The system cannot find the file specified.
Try "dir %userprofile%\desktop" and I think you'll be pleasantly
surprised.

Or if you'd rather, try "C:\Users\Steve\Desktop" which might also
work, assuming "Steve" is your current profile name.

It wasn't really that hard, was it?
 
N

Nil

It may not be secret or hidden but it's bloody hard to find.

C:\Documents and Settings\Steve>dir c:\%steve%\desktop
The system cannot find the file specified.

C:\Documents and Settings\Steve>dir c:\%Steve%\desktop
The system cannot find the file specified.

C:\Documents and Settings\Steve>dir c:\Steve\desktop
The system cannot find the file specified.
Are you deliberately not following his instructions? The correct
command is:

dir %userprofile%\desktop\

"%userprofile%" is a system variable that expands to the location of
the current user's profile. There is no variable by the name of
%steve%. You shouldn't have used it.

Unless you have a non-standard installation, the above command is
equivalent to:

dir c:\Users\Steve\Desktop\

The desktop is not hidden or hard to find. If you use the variable in
your batch file, it will work for all users, not just you.

You can see most or all available variables and their current values by
typing, at the command prompts, "SET" (without the quotes.) If you want
to see the contents of a particular variable, type at the command
prompt, "echo %VariableName%" (no quotes, insert the name of the
variable you're interested in.)
 
G

Gene E. Bloch

Try "dir %userprofile%\desktop" and I think you'll be pleasantly
surprised.

Or if you'd rather, try "C:\Users\Steve\Desktop" which might also
work, assuming "Steve" is your current profile name.

It wasn't really that hard, was it?

Depends on who(m) you ask :)

He's been given various methods, and even when he tried one, he managed
to not follow instructions...
 
S

Steve Hayes

Try "dir %userprofile%\desktop" and I think you'll be pleasantly
surprised.

Or if you'd rather, try "C:\Users\Steve\Desktop" which might also
work, assuming "Steve" is your current profile name.

It wasn't really that hard, was it?
Sorry, my Internet access has been erratic over the last few days, so I've
been busy trying to find out what is wrong with that and fix it to try all the
things suggested here.

But thanks for the suggestions anyway, I hope to try them when other things
are working better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top