Re: Dos batch file ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Reply at end

On Fri, 28 Apr 2006 16:52:29 +1000, "Pegasus \(MVP\)"
<I.can@xxxxxxx> wrote:


"Bill Watt" <nobwatt@xxxxxxx> wrote in message
news:h7r252lt41c4aoi0gjni6mlc74nvbg5svd@xxxxxxxxxx
On Thu, 27 Apr 2006 15:54:21 +1000, "Pegasus \(MVP\)"
<I.can@xxxxxxx> wrote:

SNIP

I finally got to my Daughter's house and tried it.
Xcopy c:\"%UserProfile%\*.*" E:\Savedocs\ /c /e /h /k /y /d

I'm afraid you took some liberties here:
xcopy "%UserProfile%\*.*" (this is what I wrote)
Xcopy c:\"%UserProfile%\*.*" (this is what you wrote)

I'm sure you can see the difference.

I added C:\ because I have an exact copy of C: on E:. I'll change
it.

I get a message that Windows does not recognize it as a batch file.

I assume you placed your command into a batch file. What
is the name of the batch file? Where does it reside? How did
you invoke it?

I put the line in a Savedocs.bat file and put it in the root (C:\)
along with the 3 Xcopy files. I've d-clicked it from Windows
Explorer and also ran it from the CMD prompt. I'll rename the file,
it's the same name as the folder on E:

The %UserProfile% statement, is that an environment variable???
Could you explain that?

Can long file names and DOS short filenames be used in a batch file
and the CMD prompt?

SNIP

Thanks for the help. I'll probably get to try it on Monday.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/

Environmental variables have not really changed since the old
DOS/Win98 days. They are invariably referenced with surrounding
% characters, e.g. %UserName%, %ComputerName%. To see
the full collection, type set {Enter} at the Command Prompt.

When you changed %UserProfile% to c:\%UserProfile%, you
effectively changed
c:\Documents and Settings to
c:\c:\Documents and Settings
which is obviously nonsense. I recommend you check all
your variables before you embed them in a batch file. The
command echo %UserProfile% will do it nicely.

Finally got an error "incorrect Dos version". Removed the 3 Xcopy
files I had copied from my machine and it worked fine. Created a
shortcut to the bat file on the Desktop. Did the same for their
pictures. They use it for business and they keep contracts in My
Documents and pictures of houses in another folder.

Thanks again.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/

.



Relevant Pages

  • Re: Dos batch file ?
    ... I assume you placed your command into a batch file. ... Explorer and also ran it from the CMD prompt. ... The %UserProfile% statement, ...
    (microsoft.public.win2000.general)
  • Re: Stupid Windows Tricks
    ... What happens if you try and run start c:\windows\system32\notepad.exe from a CMD prompt? ... the "start" command has been disabled... ... That is, we can go to a DOS prompt, and hamd-enter the identical line, ... But from the BATch file, ...
    (comp.lang.clipper)
  • Re: Dos batch file ?
    ... I assume you placed your command into a batch file. ... Explorer and also ran it from the CMD prompt. ... The %UserProfile% statement, ...
    (microsoft.public.win2000.general)
  • Re: log off command
    ... I simply execute the batch file and let them play... ... If it's by the hour you don't need a script. ... You can logoff a sessionname or a session ID in each case you have to ... Is it possible to issue the command from user1's logon to logoff ...
    (microsoft.public.windowsxp.basics)
  • Re: log off command
    ... I simply execute the batch file and let them play... ... If it's by the hour you don't need a script. ... You can logoff a sessionname or a session ID in each case you have to ... Is it possible to issue the command from user1's logon to logoff ...
    (microsoft.public.windowsxp.basics)