Topic: Pinning a shortcut to a CMD file to the taskbar?  (Read 4204 times)

Pinning a shortcut to a CMD file to the taskbar?
« on: November 02, 2012, 10:28:18 PM »

Zanaffer

  • Jr. Chef
  • **
  • Date Registered: Nov 2012
  • Posts: 20
Greetings, long time user of Win7PE here and I find it amazing how much better it gets every release.

On my Win7PE disk I have quite a few programs that I have the shortcuts go to cmd files rather than directly to the programs, for various reasons.  For example, the password editing program NTPWEdit, I have the shortcut go to a cmd file that makes a copy of the SAM registry file before starting NTPWEdit, just in case something goes horribly wrong.  The shortcuts to these work fine from the start menu and from the desktop, however I cannot figure out how to pin these cmd files to the taskbar.

Here's what I've found so far:
1.  Windows won't let a .cmd file itself be pinned to the taskbar, by design, however under Win7 (not PE) it can be accomplished via a shortcut to CMD.exe like this:  %systemroot%\system32\cmd.exe /C "%systemdrive%\Program Files\Herp Derp\herpderp.cmd"
2.  I have tried the following command in my script with the quotes around various parts with no avail:
Add_Pin,Taskbar,,X:\Windows\system32\cmd.exe /C "X:\Program Files\Herp Derp\herpderp.cmd","Herp Derp",,,"X\Program Files\Herp Derp\herpderp.exe"
3.  Pintool.log in X:\Windows\Temp reports that the file was "Not found", so it gets skipped, but a shortcut created manually on the desktop like follows works fine (and obviously just has a blank cmd file icon instead of the program icon):  X:\Windows\System32\cmd.exe /C "X:\Program Files\Herp Derp\herpderp.cmd"
4.  Pins to normal exe files work perfectly normally and I can get that working with a minimal of hassle, however as some of the programs I'm launching have multiple choices on what is done when starting them (such as an antivirus copying updates either from my NAS or from my UFD) I need it to start the cmd instead of the program directly.


Also, not relating to the above issue, I'm looking for a script that will look for the presence of a folder (or file) on my UFD, and then copy the contents to the RAMDrive (B:) and then add shortcuts appropriately.  I think that the "Portable Apps in PE!" script is meant to do this, but I'm not sure how this script works exactly.  I'd appreciate any light being shed this task.

Re: Pinning a shortcut to a CMD file to the taskbar?
« Reply #1 on: November 02, 2012, 11:59:02 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Welcome Zanaffer,
 :welcome:

Add_Pin on Win7PESE only supports first 2 parameters (red ones), info here:
http://theoven.org/index.php?topic=37.0



Instead, on Win7PESE, I guess (not tested on cmd now) you can create shortcut for such cmd, than pin it
(or a shortcut for cmd.exe with parameter like you write ;))


Shortly Add_Shortcut
http://theoven.org/index.php?topic=50.0
to create a .lnk first,
than use Add_Pin or use Win7PESE\Finals\"1 - Pins"

an example exists at "1 - Pins" for Opera $Start_Menu\Programs\Network\Opera12.lnk




I did not practice your portable task, so far only ideas:
it also seems to me digging "Portable Apps in PE!"  (which I have not also use) would help you,
I guess you simply need a search drives\folder\bla.cmd batch and execute that batch,
 I guess you can find such batch examples around google ....
 after achiving find-execute cmd, rest is adding to startup via Add_Shortcut,Autorun ......

 :thumbsup:

Re: Pinning a shortcut to a CMD file to the taskbar?
« Reply #2 on: November 03, 2012, 03:26:50 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Not sure if this is helpful but I put this program in the system32 folder or put the tool in the penetwork folder that copies stuff to the system 32 folder. It's called nircmd.exe ( http://www.nirsoft.net/utils/nircmd.html ) and this is an example that can be used in a script 

Quote
nircmd.exe shortcut "%LaddsUSB%\DriverPacks\PENetworkDrivers.cmd" "~$folder.desktop$" "Lan Driver Install"

Thinking about making a PE script addon for this program. Not sure if this helps you any?
« Last Edit: November 03, 2012, 03:29:02 AM by laddanator »

Re: Pinning a shortcut to a CMD file to the taskbar?
« Reply #3 on: November 03, 2012, 11:21:14 AM »

Zanaffer

  • Jr. Chef
  • **
  • Date Registered: Nov 2012
  • Posts: 20
Instead, on Win7PESE, I guess (not tested on cmd now) you can create shortcut for such cmd, than pin it
(or a shortcut for cmd.exe with parameter like you write ;))


Shortly Add_Shortcut
http://theoven.org/index.php?topic=50.0
to create a .lnk first,
than use Add_Pin or use Win7PESE\Finals\"1 - Pins"

This works.  I had the same idea about half an hour after I posted and managed to get the cmd program to pin but without an icon and without the parameters.  So, in short, to get a cmd file pinned to the taskbar, this is what must be done.

1.  Use Add_Shortcut to create a shortcut to X:\Windows\system32\cmd.exe.  For parameters, use the following:  /C "Path_to_CMD_File"
2.  Use Add_Pin to copy created shortcut to the taskbar.

Regarding my other issue:  "Portable Apps in PE!" script appears to be the way to go.  It apparently can be configured to add shortcuts to the PE after the PE is booted, based on the presence of ppApp.ini files placed in certain places.  Curiously, I'm having some difficulty with it because it doesn't appear to want to work from the B: drive though.

Re: Pinning a shortcut to a CMD file to the taskbar?
« Reply #4 on: November 03, 2012, 11:25:58 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Sorry, I see you said task bar and not desktop.

Re: Pinning a shortcut to a CMD file to the taskbar?
« Reply #5 on: November 03, 2012, 12:17:52 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Sorry, I see you said task bar and not desktop.

well, maybe, with other words " 'Pin Menu' under 'Start Button' "  :lol: :grin:

for reference:
above Zanaffer trouble continues here: http://theoven.org/index.php?topic=364
 :cheers:

 

Powered by EzPortal