Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have hundreds of shortcuts to websites where the target looks like this:

C:\Users\Herb\AppData\Local\Google\Chrome\Application\chrome.exe www.somesite.com/foo

I just upgraded to Windows 8, and the Chrome executable is now stored in Program Files; so to get these shortcuts to work, I have to change them to this:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" www.somesite.com/foo

Is there any way I can automate this change? I'm a programmer but haven't done much with Windows scripting.

share|improve this question
Probably too late but making them simple links/URL files to "http://www.somesite.com/foo" would work much better in the future. –  Deanna Oct 29 '12 at 13:28
Are these *.url files? –  William Jackson Oct 29 '12 at 14:02
No, they're not *.url files. These are shortcuts that are invoked via the Run box using the technique described here bit.ly/WVE6hs . For some reason *.url files aren't picked up - you have to make a shortcut to a browser with the URL as a command-line parameter. –  Herb Caudill Oct 29 '12 at 17:15

3 Answers 3

up vote 3 down vote accepted



a directory junction which points to

C:\Program Files (x86)\Google

using Mklink, problem solved.

share|improve this answer
Perfect, thanks! Here's the command I ended up using: mklink /D "C:\Users\Herb\AppData\Local\Google\Chrome\Application" "C:\Program Files (x86)\Google\Chrome\Application" - works like a charm. –  Herb Caudill Oct 29 '12 at 14:01
@HerbCaudill: Ah, a symlink, if that ever doesn't work try /J instead as that is more low-level. –  Tom Wijsman Oct 29 '12 at 14:15

I recently found myself with a similar issue, and decided to script modification of the links as originally requested. Perhaps someone else will find this useful. This is a PowerShell script based on a previously mentioned link, but has some improvements (only triggers on the leading path name, modifies the existing link instead of deleting/creating, has a dry-run mode, etc).

I'm not particularly knowledgeable when it comes to PowerShell, so I welcome any suggestions for improvement:

$oldPrefix = "\\OldServer\Archive\"
$newPrefix = "\\NewServer\Archive\"

$searchPath = "Z:\"

$dryRun = $TRUE

$shell = new-object -com wscript.shell

if ( $dryRun ) {
   write-host "Executing dry run" -foregroundcolor green -backgroundcolor black
} else {
   write-host "Executing real run" -foregroundcolor red -backgroundcolor black

dir $searchPath -filter *.lnk -recurse | foreach {
   $lnk = $shell.createShortcut( $_.fullname )
   $oldPath= $lnk.targetPath

   $lnkRegex = "^" + [regex]::escape( $oldPrefix ) 

   if ( $oldPath -match $lnkRegex ) {
      $newPath = $oldPath -replace $lnkRegex, $newPrefix

      write-host "Found: " + $_.fullname -foregroundcolor yellow -backgroundcolor black
      write-host " Replace: " + $oldPath
      write-host " With:    " + $newPath

      if ( !$dryRun ) {
         $lnk.targetPath = $newPath
share|improve this answer

This should be possible with PowerShell in Windows 8. I found some info here and here. I'm no PowerShell expert, but as you are a programmer, I'm sure you could find a way (and maybe post it as answer here for others to see).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.