With this script i try to convert in urls in my desktop all the bookmarks in firefox
<# .SYNOPSIS Reads Firefox recovery.js JSON file and creates URI shortcuts in a folder on the Desktop. .DESCRIPTION See above. .PARAMETER <paramName> None .EXAMPLE C:> powershell.exe -noprofile -executionpolicy bypass -File ".JSON2Shortcut.ps1" #> Function Remove-InvalidFileNameChars { param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [String]$Name ) $invalidChars = [IO.Path]::GetInvalidFileNameChars() -join '' $re = "[{0}]" -f [RegEx]::Escape($invalidChars) return ($Name -replace $re) } # Check Powershell version, ConvertFrom-JSON requires v3+ If($PSVersionTable.PSVersion.Major -lt 3) { (new-object -ComObject wscript.shell).Popup("Script requires Powershell V3",0,"OK") Exit } # Check for and read the recovery.js file and convert from JSON to objects if (!(Test-Path -Path ~AppDataR*M*F*P**s*recovery.js)) { Exit } $opentabs = (Get-Content ~AppDataR*M*F*P**s*recovery.js) | ConvertFrom-Json # Firefox # Create a folder on the Desktop based on current date/time $folder = ("Tabs-" + "{0:yyyy}" -f (Get-Date)) + ("{0:MM}" -f (Get-Date)) + ("{0:dd}" -f (Get-Date)) ` + ('{0:hh}' -f (Get-Date)) + ('{0:mm}' -f (Get-Date)) + ('{0:ss}' -f (Get-Date)) $desktop = [Environment]::GetFolderPath("Desktop") New-Item -Path $desktop -Name $folder -ItemType Directory | Out-Null # Our new folder path $scPath = $desktop + '' + $folder # Cycle through the Tabs object only getting the Entries for non-Hidden ones for($i=0; $i -lt $opentabs.windows.tabs.Count; $i++) { if (!$opentabs.windows.tabs.hidden[$i]) { # Grab the Title of the page, trim to 15 characters, add a random number, and append .url # (This becomes our shortcut name) $scName = (Remove-InvalidFileNameChars $opentabs.windows.tabs[$i].entries[-1].title.Trim()) if ($scName.Length -gt 15) { $scName = $scName.Substring(0, 15) } $scName = $scPath + '' + $scName + '_' + (Get-Random -Maximum 1000) + '.url' # Target is the URL from the object $scTarget = $opentabs.windows.tabs[$i].entries[-1].url # Create a Shortcut with Windows PowerShell using Windows Scripting interface $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($scName) $Shortcut.TargetPath = $scTarget $Shortcut.Save() } }
I have windows 8.1 running and installed windows powershell in
C:WindowsSystem32WindowsPowerShellv1.0
version 3.0
How can i depure my problem ?
Best Regards