Page 1 of 1 1
Topic Options
#164594 - 2006-07-18 01:11 PM Simple question
clmowers Offline
Fresh Scripter

Registered: 2006-01-09
Posts: 13
Hello Everyone
This is probably be the easiest question of the day. I trying to copy a .txt file from 250 computers. That part i have. The part i cant remember is how to name that file the name of the workstation it come from.So if the name of the pc is PC1 then when i copy the file i would like to rename it to PC1.txt
Can anyone help me here

Top
#164595 - 2006-07-18 01:29 PM Re: Simple question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
copy $sourcePath+"\file.txt" @wksta+".txt"
Top
#164596 - 2006-07-18 01:30 PM Re: Simple question
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Something like this should work.

Code:

Break on

$computers = Split ("pc1,pc2,pc3,pc4", ",")
For Each $computer in $computers
$source = "\\" + $computer + "\c$\somefile.txt"
$destination = "c:\" + $computer + ".txt"
Copy $source $destination
?"Copy file from: " $computer
?@ERROR
?@SERROR
Next

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#164597 - 2006-07-18 01:44 PM Re: Simple question
clmowers Offline
Fresh Scripter

Registered: 2006-01-09
Posts: 13
Thanks everyone for your help. I use the code that mart provided
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 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.051 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

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