Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, June 29, 2015 9:52 AM
Hello
I have a number of shortsuts I want to delete on the start menu within a TS. I am using the command line input. Is there a way I can put in one command line rather than one command line for every shortcut I want to delete?
Best regards, Wayne
All replies (5)
Monday, June 29, 2015 10:06 AM âś…Answered
Create a package with your script as it's content and on the task sequence, use "Run Commandline" -step and use the package you created. For the command, just type the execution command for your script inside the package.
I'd advise to use variables instead of hard-coding the paths, for example %PUBLIC%\Desktop and %PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs
Monday, June 29, 2015 9:57 AM | 1 vote
You can use a batch file for this.
Garth Jones | My blogs: Enhansoft and Old Blog site | Twitter: @GarthMJ
Monday, June 29, 2015 10:04 AM
OK, thanks but how would I run the batch file from the command line within the TS, I've tried a number of things but nothing works. who U have to creat a package first and then run that?
this is what I run from the command line within the TS
cmd.exe /c del "C:\Users\Public\Desktop\VLC Media Player.lnk" /F
cmd.exe /c del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\VideoLAN\Documentation.lnk" /F
cmd.exe /c del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\VideoLAN\Release Notes.lnk" /F
Best regards, Wayne
Monday, June 29, 2015 10:17 AM
Poweshell will be the best option I would recommend.
Sample script:
Get-ChildItem "$env:PROGRAMDATA\Microsoft\Windows\Start Menu\Programs\.lnk" -recurse|ForEach-Object { Remove-Item $_ }
Test the script before you execute.
The above script will remove all the shortcut files from start menu.
(Please click on "Vote as Helpful" and/or "Mark as Answer", if it has helped you. )
Monday, June 29, 2015 11:24 AM
I decided to do it via a batch file as I did not want to delete all the shortscuts. (thank you Vigneshwaran) I created my batch file gave it an name (batchfile.bat).
I then created a package but did not create a programme. uploaded to DP.
In my TS I created a Command Line step. pointed to the package and in the box command line I just typed batchfile.bat
Was a little confused as this is the first time I've used command line in a TS, so thank you to Narcoticoo for your help
Best regards, Wayne