You are not logged in.

#1 13 Oct 2018 11:38

chrisjj
Member
Registered: 12 Oct 2018
Posts: 12

Failure of XCOPY in a TextPad tool

On Windows 7 64-bit, when XCOPY is executed from a TextPad 64-bit tool, it silently fails.

Code:
REM Run on TP 8.1.1 (64-bit edition) as tool http://i.imgur.com/HZ47pWM.png
echo test > %TEMP%\src.bat
del /q %TEMP%\dest.bat
xcopy %TEMP%\src.bat %TEMP%\dest.bat
dir /b %TEMP%\dest.bat
REM Expected: 1 File(s)
REM Observed: File not found
30NrDmI.png

When run outside TP, I get success as expected EDIT: http://i.imgur.com/WpRRDgx.png (faulty screenshot)
With XCOPY replaced by COPY, I get success as expected http://i.imgur.com/eyCMJb9.png .

Any ideas?

Last edited by chrisjj (15 Oct 2018 12:32)

Offline

#2 13 Oct 2018 19:23

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Failure of XCOPY in a TextPad tool

Does it work if you run it outside of TextPad?
Does it work if you run it as a .CMD rather than .bat?
Is there an XCOPY.bat or XCOPY.cmd file in the temp folder?

Offline

#3 13 Oct 2018 19:37

chrisjj
Member
Registered: 12 Oct 2018
Posts: 12

Re: Failure of XCOPY in a TextPad tool

Simon Sheppard wrote:

Does it work if you run it outside of TextPad?

Yes (as I said: "When run outside TP, I get success as expected EDIT: http://i.imgur.com/WpRRDgx.png (faulty screenshot) ).

Simon Sheppard wrote:

Does it work if you run it as a .CMD rather than .bat?

No. Same fail.

Simon Sheppard wrote:

Is there an XCOPY.bat or XCOPY.cmd file in the temp folder?

No.

Thanks.

Last edited by chrisjj (15 Oct 2018 12:32)

Offline

#4 14 Oct 2018 13:11

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Failure of XCOPY in a TextPad tool

Well I don't know, it could be that 64 bit TextPad is launching a 32 bit cmd session, but even that shouldnt stop XCOPY from running.

Offline

#5 14 Oct 2018 14:51

chrisjj
Member
Registered: 12 Oct 2018
Posts: 12

Re: Failure of XCOPY in a TextPad tool

From TP, PROCESSOR_ARCHITECTURE% is AMD64, and %PROCESSOR_ARCHITEW6432% is empty.

I guess that means TP's CMD session is 64-bit.

Offline

#6 15 Oct 2018 07:10

Shadow Thief
Member
Registered: 12 Jul 2012
Posts: 205

Re: Failure of XCOPY in a TextPad tool

I was able to replicate your issue on Windows 7 64-bit with TextPad 8.1.2. After a bit of testing, I speculated that the error was a result of xcopy asking if the destination was a file or folder, so I changed the xcopy line to

echo f | xcopy "%TEMP%\src.bat" "%TEMP%\dest.bat"

and that worked.

Offline

#7 15 Oct 2018 12:37

chrisjj
Member
Registered: 12 Oct 2018
Posts: 12

Re: Failure of XCOPY in a TextPad tool

Shadow Thief wrote:

I was able to replicate your issue on Windows 7 64-bit with TextPad 8.1.2. After a bit of testing, I speculated that the error was a result of xcopy asking if the destination was a file or folder, so I changed the xcopy line to

echo f | xcopy "%TEMP%\src.bat" "%TEMP%\dest.bat"

and that worked.

Nice catch. That workaround succeeds here too:

https://i.imgur.com/HcRYlA4.png

Thanks.

But the 'f' is locale specific, meaning the solution is not robust. so I tried explicitly specifying the destination is a file by appending an asterisk, but the result was still fail:

P0lmO79.png

and still success outside TP:

bPDYngb.png

Any idea why?

Offline

#8 15 Oct 2018 13:03

chrisjj
Member
Registered: 12 Oct 2018
Posts: 12

Re: Failure of XCOPY in a TextPad tool

Update: XCOPY /? shows the same!

Outside TP, OK: https://i.imgur.com/FACCYOs.png

Inside TP, fail:

1oajGcK.png

Last edited by chrisjj (15 Oct 2018 13:07)

Offline

#9 15 Oct 2018 19:26

Shadow Thief
Member
Registered: 12 Jul 2012
Posts: 205

Re: Failure of XCOPY in a TextPad tool

This is pretty clearly an issue with Textpad. I'd recommend using something else.

Last edited by Shadow Thief (15 Oct 2018 20:46)

Offline

#10 15 Oct 2018 23:50

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Failure of XCOPY in a TextPad tool

Shadow Thief wrote:

I was able to replicate your issue on Windows 7 64-bit with TextPad 8.1.2. After a bit of testing, I speculated that the error was a result of xcopy asking if the destination was a file or folder, so I changed the xcopy line to

echo f | xcopy "%TEMP%\src.bat" "%TEMP%\dest.bat"

and that worked.

That is an interesting finding, but it still doesnt explain why it works without TextPad.

My suspicion is that TextPad is messing up the line endings to something other than CR/LF

FWIW theres a workaround for the file/folder issue on the XCOPY page, but if the line endings are wrong you will still get all number of other bugs appearing.

Offline

#11 15 Oct 2018 23:55

chrisjj
Member
Registered: 12 Oct 2018
Posts: 12

Re: Failure of XCOPY in a TextPad tool

A workaround:

 echo | xcopy /y %TEMP%\src.bat %TEMP%\dest.bat*

And mysteriously:

 echo | xcopy /?

Last edited by chrisjj (15 Oct 2018 23:55)

Offline

Board footer

Powered by