Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mrockett's avatar

Run artisan directly in Windows

Hi All,

Before my recent upgrade to Windows 10, I was able to call artisan (or whatever I may have renamed it to for certain apps) directly in both Git Bash and Windows CMD without having to prefix php. The upgrade to Win10 seems to have destroyed that, and I can't remember, for the life of me, how I got it to do that in the first place.

Any ideas as to how I can get it back?

Thanks, Mike

0 likes
11 replies
SaeedPrez's avatar

It's probably because your PHP paths are removed. What happens if you type php -v in command prompt?

Edit: If your problems are with PHP, you can remove PHP and/or reinstall it from http://windows.php.net/download#php-7.0 (PHP 7.x 64-bit recommended)

mrockett's avatar

@SaeedPrez - PHP is in my path, and I'm using EasyPHP, so it's a portable install.

Edit: If I'm remembering correctly, I'm sure I created a cmd file to get this done, but can't seem to find that file anymore... So I could be wrong.

SaeedPrez's avatar

Ah I see, you had some doskey aliases configured, I use them as well.

Do you remember where you had your aliases? If so, you can edit your CMD shortcut to something like this..

cmd.exe /k c:\path\to\aliases.cmd

When I open a new CMD tab..

mrockett's avatar

@SaeedPrez - Unfortunately, I don't remember exactly what I did. Would this work if I renamed artisan? I'm building a data platform for a client at the moment, and have renamed this to lumo - that worked out of the box without me having to manually add an alias...

mrockett's avatar

Okay, so that would mean I have to define an alias for each of my renamed artisans... Not how I had it before, but could work fine for now. Thanks.

SaeedPrez's avatar

Well, I'm assuming you had something installed that created the shortcuts for you..

I have it setup like this..

doskey pa=php artisan $*
doskey pu=.\vendor\bin\phpunit $*

So I can do..

pa
pa route:list
pa migrate

pu
pu tests/sometest.php

You can create your own shortcuts, whatever helps your workflow.

1 like
mrockett's avatar

Yeah, thanks - will work with this for now, until I find the magic method used before. :-)

mrockett's avatar

Just struck me: I'm sure I did something to support shebangs in Windows, but all the articles I've read don't seem to be what I had before. Nonetheless, still can't be sure 100% what I did to get this to work.

Please or to participate in this conversation.