Page 1 of 1 1
Topic Options
#196853 - 2009-11-27 11:33 AM echo pipe input
CrimInalA Offline
Fresh Scripter

Registered: 2007-07-05
Posts: 18
Loc: ko
I am trying to run this command in a kix script :

 Code:
echo F | XCOPY /Y "\\server\file.ini" "%windir%\file.ini"


The echo F | is needed , because otherwise the xcopy command hangs on the question if I want to copy a F(ile) or D(irectory) .

I tried

 Code:
 SHELL 'echo F | XCOPY /Y "\\server\filename1.ini" "%windir%\filename2.ini"'


But it's not working unfortunately . I know the error is somewhere in the echo F | part .


Edited by CrimInalA (2009-11-27 01:18 PM)
_________________________
no signature

Top
#196857 - 2009-11-27 03:02 PM Re: echo pipe input [Re: CrimInalA]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Is there any reason you can't use the built in COPY command in kixtart?
Top
#196859 - 2009-11-27 03:25 PM Re: echo pipe input [Re: Allen]
CrimInalA Offline
Fresh Scripter

Registered: 2007-07-05
Posts: 18
Loc: ko
Not at all , i think .
i just need to copy a file from the fileshare to the local computer .
If the file exist : overwrite .
if the file does not exist : just copy

But it seems that when i use
 Code:
copy /Y "\\server\filename1.ini" "%windir\filename2.ini"


It is not overwriting the file if it already exists \:\(


Edited by CrimInalA (2009-11-27 03:29 PM)
_________________________
no signature

Top
#196860 - 2009-11-27 03:30 PM Re: echo pipe input [Re: CrimInalA]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
COPY "source" "target"

If a file already exists at the target, it is overwritten without warning.

Copy - http://www.scriptlogic.com/Kixtart/htmlhelp/Commands/copy.htm

Top
#196861 - 2009-11-27 03:32 PM Re: echo pipe input [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Is the %windir a typo? If not... don't forget the closing %.
Top
#196862 - 2009-11-27 03:36 PM Re: echo pipe input [Re: Allen]
CrimInalA Offline
Fresh Scripter

Registered: 2007-07-05
Posts: 18
Loc: ko
%windir% i have in the script , i made a typo on the forum .

I have used copy with all possible commands after it (/c /h /r /s) , still it's not overwriting .

When i use xcopy it overwrites . only problem there is that it does not copy the file when the file does not exist (needs user input 'F')
_________________________
no signature

Top
#196863 - 2009-11-27 03:40 PM Re: echo pipe input [Re: CrimInalA]
CrimInalA Offline
Fresh Scripter

Registered: 2007-07-05
Posts: 18
Loc: ko
Ok , it seems that just copy without any arguments at all does actually overwrite the file . you are right .

Problem solved ! wew
_________________________
no signature

Top
#196864 - 2009-11-27 03:48 PM Re: echo pipe input [Re: CrimInalA]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Shew is right! Thank goodness.



Edited by Allen (2009-11-27 03:48 PM)

Top
#196866 - 2009-11-27 05:07 PM Re: echo pipe input [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Step back to your original question for a moment.. You might want to understand that you can't use piping and redirection in a Shell command without specifying "%COMSPEC% /c", since it is the command shell that is responsible for managing the IO redirection. Without it, nothing based on redirection will work.

Of course, built-in commands are best!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.062 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org