How to run a perl script in Win 10

  1. Posts : 5
    Windows 10

    How to run a perl script in Win 10

    Greetings! This is my first TenForums post. Running win 10.

    I am experimenting with a new (for me) browser called Vivaldi. I successfully imported my Firefox bookmarks, but Vivaldi's import is from a standard html file, so it does not transfer Firefox keywords as nicknames, nor does it transfer separators. Someone has written a perl script to accomplish this post import. Information about the script is located here: Annotate Vivaldi Bookmarks. Following the author's suggestion, I successfully installed activeperl.

    I see no way to contact the author. His instructions include a usage example for Windows users. The opening lines from this example are:

    > set BOOKMARKS="%LOCALAPPDATA%\Vivaldi\User Data\Default\Bookmarks"
    > set HTML="C:\Data\WWW\Checkpoints\GJS Bookmarks 2019-07-18 1732.html"
    > perl -S -trees %HTML% %BOOKMARKS%

    But when I type the first line into the CMD window, I get back a message saying that "BOOKMARKS" is not a valid command. This, of course, makes sense, but I've never done this before and don't know how to proceed next.

    If someone here would be willing to take a look at this, I'd be most grateful. Thank you.
      My Computer

  2. Samuria's Avatar
    Posts : 6,373
    windows 10

    Welcome to the forum. set assigns a variable and as such if you type it correct ahould work but try bookmarks in lowercase

    Type set on its own you should see a list of the path etc does that work ok
      My Computer

  3. Posts : 5
    Windows 10
    Thread Starter

    Thank you. I got the two set commands to work. Now I am stuck on what appears to be the final step, namely, the perl command itself:

    perl -S -trees %HTML% %BOOKMARKS%

    I got a message saying that perl is not a valid command. I tried putting "run" in front of it, but that did not help. I am in a CMD window, inside the perl folder: C:\Users\<username>\AppData\Roaming\ActiveState\bin. Do you have a next-step suggestion?

    Thank you.
      My Computer

  4. tomdsr's Avatar
    Posts : 192
    10 Pro

    Something isnt right with your pearl install?
      My Computers

  5. mngerhold's Avatar
    Posts : 784
    W10-2009 19042.1116

    Well, I was intrigued - I have never used Perl, so thought I'd give it a go and see what should happen: I installed it from the (to my mind) bizarre powershell command found on your linked page:
    Download & Install Perl | ActiveState
    and this was the response I got:
    C:\Users\mnger>powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString(''))) -activate-default ActiveState/Perl-5.32"
    ActiveState collects usage statistics and diagnostic data about failures. The collected data complies with ActiveState Privacy Policy ( and will be used to identify product enhancements, help fix defects, and prevent abuse.
    By running the State Tool installer you consent to the Privacy Policy. This is required for the State Tool to operate while we are still in beta.
    ║ Installing State Tool ║
    Installing to 'C:\Users\mnger\AppData\Roaming\ActiveState\bin'...
    Continue? [y/N]
    : y
    NOTE: C:\Users\mnger\AppData\Roaming\ActiveState\bin will be created
    Preparing for installation...
    Determining latest version...
    Fetching the latest version: 0.28.4-SHA6258a7b...
    Verifying checksums...
    ║ Exporting Configuration Data ║
    Updating environment...
    Adding C:\Users\mnger\AppData\Roaming\ActiveState\bin to user PATH
    State Tool successfully installed to: C:\Users\mnger\AppData\Roaming\ActiveState\bin.
    Please close your current terminal window and open a CMD prompt in order to start using the 'state.exe' program.  Powershell support is coming soon.
    Activating project ActiveState/Perl-5.32 as default
    ║ Activating Virtual Environment ║
    Choose Destination
    Where would you like to place the project files for ActiveState/Perl-5.32?
    > C:\Users\mnger\ActiveState\Perl-5.32
      Other ..
    At the very end I did not know what to do - it turns out that using the cursor up-down arrows toggles between those two paths: 'C:\users\...' and 'Other...', so I selected the C:\users one and hit enter (but whilst I can't repeat it, the cursor had to be in the right place - sometimes it was floating inside those options, and hitting enter did nothing). This resulted in the following response:

    Cloning Repository
    Cloning git repository at
    Enumerating objects: 120, done.
    Counting objects: 100% (120/120), done.
    Compressing objects: 100% (92/92), done.
    Total 120 (delta 69), reused 66 (delta 28), pack-reused 0
    Installing                                16/16
    Global Default
    Successfully configured ActiveState/Perl-5.32 as the global default project.
    Warning: Script Names Already In Use
    The following scripts should be renamed:
      - convert
    These scripts were not aliased during activation but can still be run using `state run`, eg.
    `state run convert`.
    Note that you can also access scripts by prefixing their script with your project name, eg.
    Running Activation Events
    Successfully created Desktop Shortcuts and File Associations.
    You are now in an activated state: a virtual environment just for this project.
    To access more of the ActiveState Platform you can visit
    Type `state run learn` to view a quick start guide of commonly used commands.
    ║ You're Activated! ║
    [ActiveState/Perl-5.32] C:\Users\mnger\ActiveState\Perl-5.32>
    I closed that cmd window (something I read somewhere said to do that) and opened another:
    resulted in a long wait and nothing else. But trying 'perl -v' worked a treat:
    C:\Users\mnger>perl -v
    This is perl 5, version 32, subversion 0 (v5.32.0) built for MSWin32-x64-multi-thread
    Copyright 1987-2020, Larry Wall
    Binary build 32.0r3 provided by ActiveState
    Built Fri Oct 30 23:03:37 2020
    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.
    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at, the Perl Home Page.
    It seems 'perl' on its own is wrong. I then went looking to see where all the ActiveState stuff was stored, and found it in
    C:\Users\mnger\AppData\Roaming\ActiveState\bin; and C:\Users\mnger\AppData\Local\activestate\bin;, both of which had been added to my 'Path' setting. Before I went further, I noticed a shortcut on my desktop called 'ActiveState Perl-5.32 CLI', which apparently pointed to %windir%\system32\cmd.exe /k state activate and started in C:/Users/mnger/ActiveState/Perl-5.32. I double clicked on it, and got this:
    How to run a perl script in Win 10-activestate-window.png
    But I must admit I didn't then follow the instruction to Type `state run learn, but went back to a web page I had been looking at: How to Install Perl and Run Your First Script which told me how to write my first perl script: I followed its simple instructions, creating this masterpiece:
    print "Enter your name: ";
    print "Hello, ${name} ... you will soon be a Perl addict!";
    opened a command prompt in the containing folder and typed 'perl':
    How to run a perl script in Win 10-my-first-perl-prog.png

    I suggest you try the same, a simple script to check what is, and isn't, working on your perl installation. This has been fun, hope it helps, Martin
      My Computer

  6. mngerhold's Avatar
    Posts : 784
    W10-2009 19042.1116

    You're welcome - don't mention it!
      My Computer


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 04:15.
Find Us

Windows 10 Forums