{"id":21047836,"url":"https://github.com/opsdisk/doskeys","last_synced_at":"2026-01-02T13:06:18.567Z","repository":{"id":62308872,"uuid":"41638153","full_name":"opsdisk/doskeys","owner":"opsdisk","description":"BASH alias-like shortcuts for Windows","archived":false,"fork":false,"pushed_at":"2016-07-24T20:33:32.000Z","size":4,"stargazers_count":25,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-05T14:56:14.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opsdisk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-30T18:11:01.000Z","updated_at":"2025-01-30T18:18:24.000Z","dependencies_parsed_at":"2022-10-30T13:02:32.977Z","dependency_job_id":null,"html_url":"https://github.com/opsdisk/doskeys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsdisk%2Fdoskeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsdisk%2Fdoskeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsdisk%2Fdoskeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsdisk%2Fdoskeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opsdisk","download_url":"https://codeload.github.com/opsdisk/doskeys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243495484,"owners_count":20299921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T14:38:26.965Z","updated_at":"2026-01-02T13:06:18.539Z","avatar_url":"https://github.com/opsdisk.png","language":null,"readme":"### Introduction\n\nEver wanted to have persistent, BASH-like aliases for Windows?  Unfortunately, Windows makes this a little more convoluted, but it is still possible!\n\nIn the Unix world, users have the ability to create a file, usually called `.bash_aliases`, that contains user-defined shortcuts for executing commands.  The example below greps out a case-insensitive string from a process list:\n\n    alias psg='ps -ef | grep -i $1'\n\nWhere `$1` is the first argument (a string in this case) to grep for.  An example would be:\n\n    user@box:~# psg fire\n    root       4604   4409 71 19:33 ?        00:00:04 /usr/bin/firefox\n\nIn the Windows world, these command line shortcuts (macros) are created using Doskey, defined as\n\n\u003e The Doskey utility lets you encapsulate command strings as easy-to-enter macros. (https://technet.microsoft.com/en-us/magazine/ff382652.aspx)\n\n### Create Your Macros\n\nThe first step is to create a text file of your macros, and save it as whatever you like, [doskey_macros.txt](https://github.com/opsdisk/doskeys/blob/master/doskey_macros.txt) is used in this example.  Below are some of my most used macros:\n\n    h=doskey /history\n    ps=tasklist $*\n    ls=dir /a /x $*\n    lt=dir /a /x /od $*\n    d=cd %USERPROFILE%\\desktop\n    p=ping yahoo.com -n 1 || ping 8.8.8.8 -n 1\n    findgrep=dir /s /a /b \\*$1*\n    n=notepad $*\n    e=explorer .\n    cya=shutdown /f /s /t 0\n    reboot=shutdown /f /r /t 0\n    pspath=wmic process get processid,parentprocessid,executablepath\n    psg=tasklist | findstr /i $1\n    nsg=netstat -nao | findstr /i $1\n    nd=mkdir $1 $t cd $1\n    cp=copy $*\n    mv=move $*\n    ifconfig=ipconfig $*\n    macros=doskey /macros\n    ip=powershell -noni -nop -ep bypass -c \"$c=new-object System.Net.WebClient;$e=$c.DownloadString('http://icanhazip.com');write-host $e\"\n    ..=cd ..\n    home=cd %USERPROFILE%\n\nMost of them should be self-explanatory...play around with them to see how they work. Just like with the BASH aliases, `$1` represents the first user-defined argument, `$*` represents all the user-defined arguments, and `$t` is used to chain commands (like `\u0026` on the command line).  More details and options can be found here: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true\n\nIn order to load the Doskey macros after opening a cmd.exe shell, the command is:\n\n    doskey /macrofile=doskey_macros.txt\n\nThat's kind of a pain to do every time you launch a shell, so how can we make it persistent so that it loads every time?  \n\n### Make the Doskey Macros Persistent\n\nThe `autorun` registry key found here `hklm\\software\\microsoft\\command processor` can be used to load your Doskey macros automatically when cmd.exe is launched.\n\n    reg query \"hklm\\software\\microsoft\\command processor\" /v autorun\n    \n    reg add \"hklm\\software\\microsoft\\command processor\" /v autorun /t reg_expand_sz /d \"doskey /listsize=999 /macrofile=c:\\users\\opsdisk\\doskey_macros.txt\" /f\n\nWhen cmd.exe is launched, it automatically loads the doskey_macros.txt file!  To my knowledge, these do not work for PowerShell (powershell.exe) shells. \n\nThe code can be found here: https://github.com/opsdisk/doskeys\n\nComments, suggestions, and improvements are always welcome. Be sure to follow [@opsdisk](https://twitter.com/opsdisk) on Twitter for the latest updates.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopsdisk%2Fdoskeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopsdisk%2Fdoskeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopsdisk%2Fdoskeys/lists"}