question

AnilkumarM avatar image
0 Votes"
AnilkumarM asked Viorel-1 edited

Unable to set TargetPath when create shortcut for a file

I am trying to create a Shortcut .lnk file for a file. but I unable to set the target path. this is my target path C:\TeklaStructures\2020.0\nt\bin\TeklaStructures.exe -I "C:\TeklaStructures\DowFirm\TS2020\Imperial\EngBypass.ini" "C:\TeklaStructures\NewModel"

this is my code

  WshShell wsh = new WshShell();
                 IWshShortcut MyShrotcut = (IWshShortcut)wsh.CreateShortcut(ModelLinkFile);
                 MyShrotcut.TargetPath = "C:\TeklaStructures\2020.0\nt\bin\TeklaStructures.exe -I \"C:\TeklaStructures\DowFirm\TS2020\Imperial\EngBypass.ini\" \"C:\TeklaStructures\NewModel\"";
                 MyShrotcut.Save();


Thanks in advance.
Anilkumar

dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
1 Vote"
Viorel-1 answered Viorel-1 edited

Try this string:

 MyShrotcut.TargetPath = @"C:\TeklaStructures\2020.0\nt\bin\TeklaStructures.exe -I ""C:\TeklaStructures\DowFirm\TS2020\Imperial\EngBypass.ini"" ""C:\TeklaStructures\NewModel""";

Also check this:

 MyShrotcut.TargetPath = @"C:\TeklaStructures\2020.0\nt\bin\TeklaStructures.exe";
 MyShortcut.Arguments = @"-I ""C:\TeklaStructures\DowFirm\TS2020\Imperial\EngBypass.ini"" ""C:\TeklaStructures\NewModel""";

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.