Discussion:
Batch File Creation
(too old to reply)
Andrew
2011-05-11 10:21:11 UTC
Permalink
Hi,

We have a requirement from our SAP Team to create a batch file which
will copy the SAP contents on users profile by creating a folder SAP

For XP: C:\documents and settings\%username%\Application Data\SAP
For Windows 7: C:\users\%username%\appdata\roaming\Sap.

I created a below batch file but unable to copy the contents on excat
location.

copy Test.xml C:\"documents and settings"\"%username%"\appdata\roaming
\sap
copy text.xml C:\users\"%username%"\"application data"\sap

Can you please assist me creating a batch file.

Thanks
Andrew
John John - MVP
2011-05-12 10:26:55 UTC
Permalink
Post by Andrew
Hi,
We have a requirement from our SAP Team to create a batch file which
will copy the SAP contents on users profile by creating a folder SAP
For XP: C:\documents and settings\%username%\Application Data\SAP
For Windows 7: C:\users\%username%\appdata\roaming\Sap.
I created a below batch file but unable to copy the contents on excat
location.
copy Test.xml C:\"documents and settings"\"%username%"\appdata\roaming
\sap
copy text.xml C:\users\"%username%"\"application data"\sap
Can you please assist me creating a batch file.
Thanks
Andrew
Do the destination folders exist? The Copy command will not create
folders, you have to use the MD command to create the folders, then the
copy command will be able to copy the file. Better yet would be to use
a command or tool that can create folders, like Xcopy or Robocopy.
Also, unless the command is launched in the source directory you need to
supply the fully qualified path of the source file, where is this
Test.xml file located? How would the Copy command (or Xcopy or
Robocopy) know that?

John
Andrew
2011-05-24 06:44:12 UTC
Permalink
Post by Andrew
Hi,
We have a requirement from our SAP Team to create a batch file which
will copy the SAP contents on users profile by creating a folder SAP
For XP: C:\documents and settings\%username%\Application Data\SAP
For Windows 7: C:\users\%username%\appdata\roaming\Sap.
I created a below batch file but unable to copy the contents on excat
location.
copy Test.xml C:\"documents and settings"\"%username%"\appdata\roaming
\sap
copy text.xml C:\users\"%username%"\"application data"\sap
Can you please assist me creating a batch file.
Thanks
Andrew
Do the destination folders exist?  The Copy command will not create
folders, you have to use the MD command to create the folders, then the
copy command will be able to copy the file.  Better yet would be to use
a command or tool that can create folders, like Xcopy or Robocopy.
Also, unless the command is launched in the source directory you need to
supply the fully qualified path of the source file, where is this
Test.xml file located?  How would the Copy command (or Xcopy or
Robocopy) know that?
John- Hide quoted text -
- Show quoted text -
Thanks John,

We will be deploying the batch file Via SCCM, so the source file will
be in cache folder on every folder.
Ya i am able to create a folder using xcopy.
Special Access
2011-05-25 00:46:36 UTC
Permalink
On Mon, 23 May 2011 23:44:12 -0700 (PDT), Andrew
<SNIP>

Try putting quotes around the entire line:
copy Test.xml "C:\documents and
settings\%username%\appdata\roaming\sap"
and
copy text.xml "C:\users\%username%\application data\sap"

or specify a destination file name in addition to the location

The recommendation of xcopy or robocopy is a good one, as both are
much better than just 'copy'... xcopy syntax is similar to copy, but
Robocopy's syntax is quite different.

Mike

Loading...