Information générale
Titre:
ShortCuts creation, WSH, quotes
Hi UTers,
I am using the Windows Scripting Host (WSH) to automate the creation of a Desktop Shortcut. I have a problem with the quotes that are added to my targetpath by either windows or the WSH. I don't want them because windows swawks about my path when I include switches in my command line. This is the code:
loshell = createobj("WScript.Shell")
strDeskTop = loShell.SpecialFolders("DeskTop")
oShellLink = loShell.CreateShortCut(strDeskTop + "\Practice Administration.lnk")
** I need to have -t -cc:\protemps\ti.fpw on the command line
** if you look at the properties of the shortcut
** after this program is run, you will see that
** the targetpath (the command and the included -t-c: switches)
** are sourounded in quotes.
strCommandline = "c:\gmg_win\wingmg.exe -t -cc:\protemps\ti.fpw"
oShellLink.TargetPath= strCommandLine
oShellLink.WorkingDirectory="c:\gmgwin"
oShellLink.WindowStyle=1
oShellLink.Description="Practice Administration"
oShellLink.save
oShellLink = null
release oShellLink
loShell = null
release loShell
If you run my code you will get a shortcut created but windows will tell you that your target path is invalid if you attempt to look at the properties of the shortcut and attempt to exit the properties dialog. If you remove the quotes around the targetpath or just limit them to the actual file ie: c:\gmg_win\wingmg.exe windows has no problem.
Any suggestions on how to make a shortcut with command line switches?
Dr. G. (Neil)
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement