简体   繁体   English

使用批处理文件从“开始”菜单中删除项目

[英]Remove an item from the Start menu using batch file

I want to remove an item from the start menu using batch scripts in admin mode ofcourse I tried the following 我想在课程管理模式下使用批处理脚本从开始菜单中删除项目我尝试了以下操作

Set scut=C:\users
del /s /q /f %scut%\name of shortcut.lnk

but it does not seem to be working. 但它似乎不起作用。 can anyone please point me to the right direction. 谁能给我指出正确的方向。

I will make the question a bit clear by providing screen shot 我将通过提供屏幕截图来使问题更清晰 在此处输入图片说明 here actually I want to remove Notepad or Microsoft Word 2010 or notepad++.exe using command prompt 在这里我实际上想使用命令提示符删除记事本或Microsoft Word 2010或notepad ++。exe

I'm not sure if I got your question right... 我不确定我是否正确回答了您的问题...

If you want to delete a shortcut from the windows start menu you must know where the .lnk files are located: 如果要从Windows开始菜单中删除快捷方式,则必须知道.lnk文件的位置:

Per-user menu: C:\\Users[username]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu All user's menu: C:\\ProgramData\\Microsoft\\Windows\\Start Menu 每用户菜单:C:\\ Users [用户名] \\ AppData \\ Roaming \\ Microsoft \\ Windows \\ Start菜单所有用户菜单:C:\\ ProgramData \\ Microsoft \\ Windows \\ Start菜单

So the code should be something link this: 所以代码应该是链接此的东西:

DEL /Q "C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\shortcut.lnk"

or 要么

DEL /Q "C:\ProgramData\Microsoft\Windows\Start Menu\shortcut.lnk"

If the .lnk is located in a subfolder you'll obviously have to modify the path ;-) 如果.lnk位于子文件夹中,则显然必须修改路径;-)

Set scut=C:\Users
cd /d %scut%
del /s /q /f "name of shortcut.lnk"

So, change directory to %scut% and recursively delete the shortcut in double quotes (because spaces). 因此,将目录更改为%scut%并递归删除双引号中的快捷方式(由于空格)。

Try http://superuser.com next time, it's more IT Pro audience oriented. 下次尝试http://superuser.com时,它将更加面向IT Pro受众。

EDIT. 编辑。 Apparently del doesn't follow SYMLINKS, so "%scut%\\All Users\\" becomes a particular case, just add it at the end. 显然del不遵循SYMLINKS,因此"%scut%\\All Users\\"成为一种特殊情况,只需在末尾添加即可。

cd /d "%scut%\All Users"
del /s /q /f "name of shortcut.lnk"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM