Jump to content

Recommended Posts

Posted

I wold like to set this command ( oShellLink.TargetPath = ) able to identify and search "Drive and Folder" automatically by itself.

For example command

set WshShell = WScript.CreateObject("WScript.Shell")
strDirectory = "MyApp"
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists(strDirectory) Then
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End if

strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\MyApp\app.lnk")
oShellLink.TargetPath = "sPath & "\MyAppFolder\app.exee" 
oShellLink.IconLocation = "?:\MyAppFolder\app.exe"
oShellLink.WindowStyle = 1
oShellLink.Description = "Thankyou use"
oShellLink.WorkingDirectory = "?:\MyAppFolder\"
oShellLink.Save

"?" in the example command is the "drive" that will be searched, identified and verified automatically by the program

Posted (edited)

Could you formulate your question again - but in a different way ?

btw.

Please read:   * How to post code on the forum *

set WshShell = WScript.CreateObject("WScript.Shell")
strDirectory = "MyApp"
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists(strDirectory) Then
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End if

strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\MyApp\app.lnk")
oShellLink.TargetPath = sPath & "\MyAppFolder\app.exe" 
oShellLink.IconLocation = "?:\MyAppFolder\app.exe"
oShellLink.WindowStyle = 1
oShellLink.Description = "Thankyou use"
oShellLink.WorkingDirectory = "?:\MyAppFolder\"
oShellLink.Save

 

edit:
There was an error in this line:

oShellLink.TargetPath = "sPath & "\MyAppFolder\app.exee"

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...