如何使用C#在快捷方式文件中添加正斜杠。 [英] How to add forward slash in shortcut file create using C# .
问题描述
var wsh = new IWshShell_Class();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop)+ \\shorcut2.lnk) as IWshRuntimeLibrary.IWshShortcut;
shortcut.TargetPath = @ C:\ Users \Zimin \Desktop\test folder 跨度>;
shortcut.Save();
i想要使用c#创建任务调度程序的快捷方式文件。
并添加TargetPath = C :\ Windows \ System32 \schtasks.exe / RUN / TN myapplicaion。
我尝试过:
var wsh = new IWshShell_Class();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(
Environment.GetFolderPath(Environment .SpecialFolder.Desktop)+\\shorcut2.lnk)作为IWshRuntimeLibrary.IWshShortcut;
shortcut.TargetPath = @C:\ Users \Zimin\Desktop\test文件夹;
shortcut.Save();
只需在代码/中键入正斜杠,它就会接受它。
例如
string myString = @C:\ Windows \ System32 \schtasks.exe / RUN / TN myapplication;
var wsh = new IWshShell_Class();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\shorcut2.lnk") as IWshRuntimeLibrary.IWshShortcut;
shortcut.TargetPath = @"C:\Users\Zimin\Desktop\test folder";
shortcut.Save();
i want to create shortcut file of task scheduler using c#.
and also add TargetPath = C:\Windows\System32\schtasks.exe /RUN /TN myapplicaion .
What I have tried:
var wsh = new IWshShell_Class();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\shorcut2.lnk") as IWshRuntimeLibrary.IWshShortcut;
shortcut.TargetPath = @"C:\Users\Zimin\Desktop\test folder";
shortcut.Save();
Just type the forward slash in your code "/" and it will accept it.
e.g.
string myString = @"C:\Windows\System32\schtasks.exe /RUN /TN myapplication";
这篇关于如何使用C#在快捷方式文件中添加正斜杠。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!