Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy Files Shortcut pointing to
Message
From
26/04/1998 09:33:46
 
 
To
22/04/1998 08:42:29
General information
Forum:
Windows
Category:
Other
Miscellaneous
Thread ID:
00092706
Message ID:
00094963
Views:
23
>>>Hi, all
>>>
>>>Is there a way to copy or move files that a Windows 95 shortcut is pointing to
>>>
>>
>>Could you clarify this? Do you want to move the shortcut, the target of the shortcut or resolve the shortcut when the location of the starting directory or target executable has moved?
>
>
>Hi, Ed
>
>I have several files located in different folders, and one folder that contains Windows shortcuts for each of these files. I would like to copy OR move the files that the shortcuts are pointing to, not the shortcut itself as Windows does now.
>

You'll need to recreate the shortcut; the QUAD way to do this is to use SHORTCUT.EXE with command line parameters to recreate the shortcut with a new target path. This can be done programmatically as well. You'd use SHORTCUT's -d parameter to set the target directory; the starting program can be set with the -t parameter. The following is sample VFP code to create a command line for SHORTCUT from VFP from a specified set of parameters:


LPARAMETERS nFileHandle,cShortCutName, cTargetExe, cStartDir, cIconFile, cArgs
LOCAL cRunCommand, aTest[1,5]
IF TYPE('cShortCutName') # 'C' OR ;
TYPE('cTargetExe') # 'C'
RETURN ''
ENDIF
IF TYPE('cStartDir') # 'C'
cStartDir = ''
ENDIF
IF TYPE('cArgs') # 'C'
cArgs = ''
ENDIF
IF TYPE('cIconFile') # 'C'
cIconFile = ''
ENDIF

cRunCommand = 'SHORTCUT -f -n '
IF ADIR(aTest,LEFT(cShortCutName,RAT('\',cShortCutName)-1),'D') = 0
=MessageBox('Invalid ShortCut file name "'+cShortCutName+'"', ;
16, ;
'Cannot create ShortCut')
RETURN ''
ENDIF
IF ' ' $ cShortCutName
cShortCutName = '"'+cShortCutName+'"'
ENDIF
cRunCommand = cRunCommand + cShortCutName + ' -t '
IF ! FILE(cTargetExe)
=MessageBox('Cannot find executable program "'+cTargetExe+'"', ;
16, ;
'Cannot create ShortCut')
RETURN ''
ENDIF
IF ' ' $ cTargetExe
cTargetExe = '"'+cTargetExe+'"'
ENDIF
cRunCommand = cRunCommand + cTargetExe
IF LEN(cStartDir) > 0
IF ADIR(aTest,cStartDir+'\*.*','D') = 0
=MessageBox('Invalid Start Directory "'+cStartDir+'"', ;
16, ;
'Cannot create ShortCut')
RETURN ''
ENDIF
IF ' ' $ cStartDir
cStartDir = '"'+cStartDir+'"'
ENDIF
cRunCommand = cRunCommand + ' -d ' + cStartDir
ENDIF
IF LEN(cArgs) > 0
IF ' ' $ cArgs
cArgs = '"'+cArgs+'"'
ENDIF
cRunCommand = cRunCommand + ' -a ' + cArgs
ENDIF
IF LEN(cIconFile) > 0
IF ! FILE(cIconFile)
=MessageBox('Cannot find Icon File "'+cIconFile+'"', ;
16, ;
'Cannot create ShortCut')
RETURN ''
ENDIF
IF ' ' $ cIconFile
cIconFile = '"'+cIconFile+'"'
ENDIF
cRunCommand = cRunCommand + ' -i ' + cIconFile
ENDIF
RETURN cRunCommand
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform