Code de ligne de commande pour verrouiller le programme dans la barre des tâches Windows 10?

J'essaie de réimporter plusieurs ordinateurs et je fais un fichier batch pour exécuter les commandes de base. Existe-t-il un code de ligne de commande qui me permettra d'épingler des programmes à la barre des tâches? Par exemple, Internet Explorer.

Vous devez créer un raccourci, puis déplacer ce raccourci dans le dossier épinglé par l'utilisateur.

Le dossier UserPinned est ici: %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Ici, nous allons créer un raccourci du bloc-notes (notepad.lnk) et le déplacer vers le dossier épinglé par l'utilisateur.

Les seules choses à modifier pour vos applications sont les suivantes:

SLinkFile = Nom de votre raccourci (application_Name.lnk habituellement)

OLink.TargetPath = Chemin de votre application racine (c: \ program files \ program \ program.exe)

 @echo off echo Set oWS = WScript.CreateObject("WScript.Shell") > C:\temp8\CreateShortcut.vbs echo sLinkFile = "C:\temp8\notepad.lnk" >> C:\temp8\CreateShortcut.vbs echo Set oLink = oWS.CreateShortcut(sLinkFile) >> C:\temp8\CreateShortcut.vbs echo oLink.TargetPath = "C:\Windows\notepad.exe" >> C:\temp8\CreateShortcut.vbs echo oLink.Save >> C:\temp8\CreateShortcut.vbs cscript C:\temp8\CreateShortcut.vbs del C:\temp8\CreateShortcut.vbs copy "C:\temp8\notepad.lnk" "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\notepad.lnk" pause 

Vous pouvez supprimer la pause , je l'ai simplement fait pour la vérification des erreurs. Copiez le code ci-dessus dans votre fichier bat.

Modifier: explication détaillée:

Essentiellement, les symboles > et les >> symboles ajoutent des données à un document. Dans ce cas, nous créons un fichier .vbs distinct appelé CreateShortcut.vbs et chaque commande avant que> ou >> soit mis dans ce fichier, ligne par ligne. À la fin du lot, nous cscript CreateShort.vbs qui exécute le fichier que nous venons de construire.

 @echo off REM Create a new obj for shell script and write as line 1 in new file call createshortcut.vbs echo Set oWS = WScript.CreateObject("WScript.Shell") > C:\temp8\CreateShortcut.vbs REM Name the shortcut whatever you want. It will end in .lnk and then write that command as the second line in the createshortcut.vbs file echo sLinkFile = "C:\temp8\notepad.lnk" >> C:\temp8\CreateShortcut.vbs REM takes the shortcut file and runs the builtin script "create Shortcut to generate the .lnk file and adds as the third line in the createshortcut.vbs file echo Set oLink = oWS.CreateShortcut(sLinkFile) >> C:\temp8\CreateShortcut.vbs REM this is physical path of the EXE or application you are making a shortcut for, then adds that path as the 4th line in the createshortcut.vbs file echo oLink.TargetPath = "C:\Windows\notepad.exe" >> C:\temp8\CreateShortcut.vbs REM saves everything and writes as the 5th line in the vbs file echo oLink.Save >> C:\temp8\CreateShortcut.vbs REM executes the createshortcut.vbs file that we built line by line above cscript C:\temp8\CreateShortcut.vbs REM Deletes the createshortcut.vbs script that we made after it ran so you can use this block of code in the same batch more than once del C:\temp8\CreateShortcut.vbs REM Copies the newly created shortcut file notepad.lnk to the directory that windows looks at to generate what icons/applications appear on the taskbar copy "C:\temp8\notepad.lnk" "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\notepad.lnk"