#106097 - 2003-10-18 12:40 AM
editshortcut problem
|
anna
Getting the hang of it
Registered: 2001-08-21
Posts: 71
Loc: Los Angeles, cA
|
Hi guys,
I need your help again. I am trying to change the target location of a shortcut to a batch file. Here's code:
$desktop = "c:\documents and settings\@userid\desktop" $x = EditShortcut($desktop,"Backup Username.bat.lnk","\\labup2\scripts$\2000backup.bat username","\\labup2\scripts$\2000backup.bat @userid")
It won't make the change. What am I doing wrong? any suggestions? thanks Anna
|
|
Top
|
|
|
|
#106100 - 2003-10-18 03:30 AM
Re: editshortcut problem
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
may need to edit the UDF and enable an additional parameter...
oShellLink.Arguments = "C:\myFile.txt"
|
|
Top
|
|
|
|
#106101 - 2003-10-18 04:21 AM
Re: editshortcut problem
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
Hello Anna,
Please give this code sample a try.
Howard found an issue with this UDF that I'll post to Shawn. Copy the code below and edit as required.
Let us know if you have problems with it.
code:
dim $Desktop,$UpdateBackupLink,$Pause $Desktop=readvalue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Desktop')
$UpdateBackupLink = WshShortCut($Desktop+'\'+'Backup Username.bat.lnk','\\labup2\scripts$\2000backup.bat',@USERID,'\\labup2\scripts$\','%SystemRoot%\system32\SHELL32.dll,6') ? 'Shortcut creation: '+@error+' '+@serror get $Pause
Function WshShortCut( $path, $targetpath, optional $arguments, optional $startdir, optional $iconpath, optional $style) Dim $shell,$shortcut $shell = createobject("wscript.shell") if $shell $shortcut = $shell.createshortcut($path) if $shortcut $shortcut.targetpath = $targetpath if $arguments $shortcut.arguments = $arguments endif if $startdir $shortcut.workingdirectory = $startdir endif if $iconpath $shortcut.iconlocation = $iconpath endif if $style $shortcut.windowstyle = $style endif $shortcut.save $shortcut = 0 endif $shell = 0 endif exit @error EndFunction
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 476 anonymous users online.
|
|
|