Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy Files Shortcut pointing to
Message
From
27/04/1998 09:19:09
 
 
General information
Forum:
Windows
Category:
Other
Miscellaneous
Thread ID:
00092706
Message ID:
00095107
Views:
30
>>>>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

Thanks Ed

For the code I'll look it over, Actualy I was looking for some way to do this copy not Via Foxpro, but rather Via the Windows95 operating system. i'm sorry I was'nt to clear on that. but i'm sure the code will come in handy.

Russ
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform