Answer» Hi, I have searched but just don't seem to be able to get an answer. I'm trying to CREATE a shortcut USING a .bat FILE. It runs a program which in effect runs an access applicatioin. However, I want to supply command argumants to the target of the shortcut. The following contents of the batch work fine. However I want to add the comman arguments on the end and am Having trouble.
here's the script that works
@echo off echo Set oWS = WScript.CreateObject("WScript.Shell") > P:\docs\h\g\h\hgh1\1\CreateShortcut.vbs echo sLinkFile = "P:\docs\h\g\h\hgh1\1\Review.lnk" >> CreateShortcut.vbs echo Set oLink = oWS.CreateShortcut(sLinkFile) >> CreateShortcut.vbs echo oLink.TargetPath = "\\pts-app\partner\PTS-Apps\Partner_Review.accdb" >> CreateShortcut.vbs echo oLink.Save >> CreateShortcut.vbs cscript CreateShortcut.vbs del CreateShortcut.vbs
As you can see, the target path is :- \\pts-app\partner\PTS-Apps\Partner_Review.accdb
However, I need it to be :- \\PTS-APP\Partner\PTS-Apps\Partner_Review.accdb /cmd "XXX000000000031|1|"
Any ideas on how to generate that. The quotes are driving me mad.
There is a program to create shortcuts in batch. SHORTCUT.EXE (Google it.) Did you already read this? https://superuser.com/questions/392061/how-to-make-a-shortcut-from-cmd It says: Quote Seems like there is some shortcut.exe in some resource kit which I don't have. As many other sites mention, there is no built-in way to do it from a batch file. It is from the Windows 95 support tools and NT 4 Server Resource Kit. Unfortunately, there are are other programs with the same or similar name and do not do the same thing. Here is more information: https://ss64.com/nt/shortcut.html Let me know if you want to consider SHORTCUT.EXE You want to set the Arguments property. The Target Path must point at a file and cannot have arguments. Quotes are escaped in VBscript by doubling them up.
Code: [Select]echo oLink.TargetPath = "\\pts-app\partner\PTS-Apps\Partner_Review.accdb" >> CreateShortcut.vbs echo oLink.Arguments = "/cmd ""XXX000000000031|1|""" >> CreateShortcut.vbs
However, this might not work. it depends how accdb file types are associated and how they are launched.New to this site so apologies if I'm posting n the wrong place. THis is brilliant. THanks you so much. It WORKED a treat.
Quote from: BC_Programmer on June 04, 2017, 04:41:11 PMYou want to set the Arguments property. The Target Path must point at a file and cannot have arguments. Quotes are escaped in VBscript by doubling them up.
Code: [Select]echo oLink.TargetPath = "\\pts-app\partner\PTS-Apps\Partner_Review.accdb" >> CreateShortcut.vbs echo oLink.Arguments = "/cmd ""XXX000000000031|1|""" >> CreateShortcut.vbs
However, this might not work. it depends how accdb file types are associated and how they are launched.
|