Solved Why is my script working no more?

June 12, 2016 at 02:41:46
Specs: Windows 10
Hello everyone,
I have this bat that i put together using several guides on the internet; while it did work when I had Win 7 it doesn't work under Win 10. Has anything changed with xcopy?

The purpose of this script is to copy a single file into multiple locations and rename them according to the list.

It basically looks like this:

cd "B:\NHM\folder\workshop\player\items"
xcopy blank.vtx all_class\executionerhood_heavy.dx90.vtx /v /c /h /r /k /o /y
xcopy blank.vtx demo\tamoshanter.dx80.vtx/v /c /h /r /k /o /y
xcopy blank.vtx heavy\hm_shirt.dx80.vtx/v /c /h /r /k /o /y
xcopy blank.vtx engineer\bet_pb.dx90.vtx /v /c /h /r /k /o /y

When executing this bat, no files are copied and it only returns "Invalid number of parameters".

I'd be grateful for any help.

See More: Why is my script working no more?

Reply ↓  Report •

June 12, 2016 at 04:48:25
✔ Best Answer
First see if the CD works.
After this line:
cd "B:\NHM\folder\workshop\player\items"
put in:
echo !CD!
[This assumes you start the script with:
setLocal enableDELAYedeXpansioN]

If it doesn't get where it's going, change CD to PUSHD and try again.
moving right along...

try putting double quotes around the dest:
"all_class\executionerhood_heavy.dx90.vtx" /v /c /h /r /k /o /y


M2 Get custom script or take private lessons

Reply ↓  Report •

June 12, 2016 at 07:12:34
Good news, using pushd, the quotation marks and launching it as admin made it work as intended; yet now it is ansking me whether the name is a file name or a directory. But that shouldn't be too much of a problem, I can just hold the button.

Thank you for your help

Reply ↓  Report •

June 12, 2016 at 12:06:47
echo f | xcopy ...
echo d | xcopy ...
will get around this last problem, answering "f" for file or "d" for directory responses,

Reply ↓  Report •

Related Solutions

June 12, 2016 at 13:22:26
You might also consider using COPY instead of XCOPY, as you don't need the advanced features of XCOPY to copy single files.

How To Ask Questions The Smart Way

Reply ↓  Report •

Ask Question