Page 1 of 1 1
Topic Options
#43073 - 2003-07-19 10:46 PM Copy command
kdm Offline
Fresh Scripter

Registered: 2001-10-25
Posts: 31
Loc: Harrisburg, PA
Kixtart 4.11, 4.21 (tried this with both)

I'm trying to copy a shortcut from the scripts folder to the C:\ drive. The first line below is in my script but it doesn't copy and no errors are displayed.
copy @lserver+"\netlogon\shortcuts\shortcut.lnk" "C:\"

I then told it to print to the screen and the source path and destination path all run together. Any ideas why this would happen?

This is the output:
\\server\netlogon\shortcuts\Shortcut.lnkC:\

Top
#43074 - 2003-07-19 10:51 PM Re: Copy command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It is a matter of quotes.

$Source = @lserver+'\netlogon\shortcuts\shortcut.lnk'
$dest = 'C:\'

Copy $Source $dest

There are several FAQs on quotes.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43075 - 2003-07-19 10:51 PM Re: Copy command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
please post your code.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#43076 - 2003-07-19 10:55 PM Re: Copy command
kdm Offline
Fresh Scripter

Registered: 2001-10-25
Posts: 31
Loc: Harrisburg, PA
$w2kDesktop = "C:\Documents and Settings\All Users\Desktop"
$w9xDesktop = "c:\windows\all users\desktop"
if exist ($w2kDesktop)
copy @lserver+"\netlogon\shortcuts\Psynet(New Server).lnk" $w2kDesktop
? @lserver+"\netlogon\shortcuts\Psynet(New Server).lnk" $w2kDesktop
else
copy @lserver+"\netlogon\shortcuts\Psynet(New Server).lnk" $w9xDesktop
endif

[ 19. July 2003, 22:56: Message edited by: kdm ]

Top
#43077 - 2003-07-19 10:57 PM Re: Copy command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You need to wrap double qoutes inside single quotes. It's explained in the FAQs.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43078 - 2003-07-19 11:03 PM Re: Copy command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Additionally, in order to display error codes, use
code:
? 'Error '+@ERROR+' - '+@SERROR

_________________________
There are two types of vessels, submarines and targets.

Top
#43079 - 2003-07-19 11:10 PM Re: Copy command
kdm Offline
Fresh Scripter

Registered: 2001-10-25
Posts: 31
Loc: Harrisburg, PA
Here is my new code:
$Source = @lserver+'\netlogon\shortcuts\Psynet(New Server).lnk'
$w2kDesktop = 'C:\'
$w9xDesktop = 'C:\'
if exist ($w2kDesktop)
copy $source $w2kDesktop
? "Windows 2000"
? $source $w2kDesktop
? 'Error '+@ERROR+' - '+@SERROR
else
copy $ Source $w9xDesktop
? "Windows 9x"
endif

Here is the output with error:
Windows 2000
\\server\netlogon\shortcuts\Psynet(New Server).lnkC:\
Error 2 - The system cannot find the file specified.

Top
#43080 - 2003-07-19 11:14 PM Re: Copy command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
As the error message says, KiXtart cannot find the file on the server
code:
$Source = @lserver+'\netlogon\shortcuts\Psynet(New Server).lnk' 

$w2kDesktop = 'C:\'

$w9xDesktop = 'C:\'

if exist($source)
select
case exist($w2kDesktop)
copy $source $w2kDesktop
? "Windows 2000"
? $source+' '+$w2kDesktop
? 'Error '+@ERROR+' - '+@SERROR
case exist($w9xDesktop)
? "Windows 9x"
copy $Source $w9xDesktop
? 'Error '+@ERROR+' - '+@SERROR
case 1
endselect
else
? 'Cannot find source file '+$source
endif

_________________________
There are two types of vessels, submarines and targets.

Top
#43081 - 2003-07-19 11:15 PM Re: Copy command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Your output error is caused by not including a space.

? $source + " " + $w2kDesktop

Your file not found problem is something you will have to resolve by using the correct path and filename of an existing file.

[ 19. July 2003, 23:17: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#43082 - 2003-07-19 11:21 PM Re: Copy command
kdm Offline
Fresh Scripter

Registered: 2001-10-25
Posts: 31
Loc: Harrisburg, PA
I tried including the space (copy $source + " " + $w2kDesktop) and I receive this error:
ERROR : Error in expression.!
Script: C:\WINNT\SYSVOL\sysvol\domain\scripts\training.kix
Line : 5

I think the reason I get the file not found error is bacuase of the space not being included.
This is driving me crazy!
I do appreciate the help though. Ecspecially on a Saturday.

Any other ideas?

Top
#43083 - 2003-07-19 11:24 PM Re: Copy command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You need to enter the correct syntax!
code:
copy $source $dest

Please follow our code examples carefully!
_________________________
There are two types of vessels, submarines and targets.

Top
#43084 - 2003-07-19 11:47 PM Re: Copy command
kdm Offline
Fresh Scripter

Registered: 2001-10-25
Posts: 31
Loc: Harrisburg, PA
Thanks for all your help I just realized the shortcut I was trying to copy has an extension of .url and not .lnk. Time to drink a few beers!!
Top
#43085 - 2003-07-20 04:31 PM Re: Copy command
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You can establish where the Desktop, Start Menu, etc. is located at, for example -
code:
$dt=READVALUE('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Common Desktop')

Have a look at -

KiXtart FAQ & How to's

Copy a shortcut to the Desktop, Start Menu, etc.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

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 1003 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.064 seconds in which 0.025 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