Questions tagged [doskey]

Windows command that recalls previously entered command-line commands, edits command lines, and creates command macros. Cannot be used in a batch file.

Documentation:

54 questions
21
votes
6 answers

How can I return to the previous directory in windows command prompt?

I often want to return to the previous directory I was just in in cmd.exe, but windows does not have the "cd -" functionality of Unix. Also typing cd ../../.. is a lot of typing. Is there a faster way to go up several directory levels? And ideally…
ggb667
  • 1,881
  • 2
  • 20
  • 44
14
votes
4 answers

How to define a DOSKEY alias for multiple commands?

Following on from an answer to this question For the Windows command prompt I can define aliases as follows: @echo off DOSKEY ns=npm start DOSKEY nsr=npm run serve I want to define an alias that will combine these two commands. I tried the…
gburnett
  • 755
  • 8
  • 18
14
votes
1 answer

How to remove a doskey macro?

I have created a doskey macro I want to remove. How do I delete it? How can I see all the macros I have created?
Wosh
  • 1,565
  • 2
  • 17
  • 30
9
votes
1 answer

Nesting doskey macros

I'd just like to know if there is a way to call one doskey macro from another. I tried the following, but it doesn't work: >doskey cleanpix=%PATH%\cleanpix.bat >doskey cp=cleanpix What am I doing wrong? If there's no way to do what I'm trying to…
user3338441
  • 89
  • 1
  • 3
7
votes
2 answers

DOSKEY alias does not work in batch script (Windows 7)

I added a DOSKEY alias via batch script (script1.bat) and try to call it in another batch script. It doesn't work. script1.bat: set USER_SETTINGS=%DRIVE%\programme\settings.xml DOSKEY mvn=mvn --settings %USER_SETTINGS% -X $* script2.bat: mvn clean…
emi-le
  • 756
  • 9
  • 26
6
votes
1 answer

Evaluate environment variable at runtime with doskey

I'm creating a simple environment setup cmd script and I'm using doskey to setup various aliases and macros. The environment I'm on has various repositories and I wanted to create some macros for quick navigation of popular directories. I currently…
Fizz
  • 3,427
  • 4
  • 27
  • 43
5
votes
1 answer

Set aliases in PowerShell using doskey macros

Is this possible? I have tried this blog, but it doesn't work. I have a macrofile with about 50 or so doskey macros, which is used in cmd.exe. I run something like: doskey /exename=powershell.exe /macrofile=C:\macrofile.txt or doskey…
vi-ap
  • 53
  • 1
  • 4
5
votes
1 answer

DOSKEY recall alias

Is it possible to recall an alias with DOSKEY? Simple example .. I wish to do something like that: DOSKEY a=someCommand DOSKEY b=someOtherCommand DOSKEY c=andAThirdCommand :: How to do this? -> DOSKEY all=a+b+c I already know that I can do this by…
BAERUS
  • 4,009
  • 3
  • 24
  • 39
5
votes
2 answers

Redirecting STDERR and STDOUT in a DOSKEY macro

I am trying to define a DOSKEY macro that redirects both STDOUT and STDERR output to a file. The doskey will be set by running a batch file. I can do this for STDOUT only with the following: doskey logged_build=build $g build.log However, I cannot…
BrannDon
  • 71
  • 1
  • 6
4
votes
3 answers

How to get full command from doskey alias in Windows PowerShell

I'm using Windows PowerShell and it is configured using doskey macros. I have a file named Macros.doskey. 105=code E:\static5\105 135=code E:\static5\135 static5=code E:\static5 How can I get the command corresponding to alias name ? For example,…
Sanjay Raz
  • 135
  • 6
4
votes
1 answer

Preserving doskey context after pipe, or, and

I have multiple doskeys defined in following fashion: doskey ll=dir $* doskey grep=findstr $* doskey make=mingw32-make $* I want to use them in conjunction in one-line commands such as: ll | grep my_folder or make && make install But after first…
doomista
  • 501
  • 2
  • 10
4
votes
1 answer

How to workaround doskey's special character, like $L

I got a useful tip from this post: https://stackoverflow.com/a/374363/151453 , but plagued by doskey's special characters. (env: Windows 7 and Windows XP) Using Visual C++ command line, we have env-vars INCLUDE and LIB. So with this doskey…
Jimm Chen
  • 3,411
  • 3
  • 35
  • 59
3
votes
1 answer

How to pass command line arguments to a PowerShell script invoked by a doskey

I have a caller.cmd file which has a DOSKEY set like this: DOSKEY startnow=call powershell getscalled.ps1 Now the script getscalled.ps1 has two switch parameters defined in parameter sets like this: param( …
cs_love
  • 35
  • 6
3
votes
1 answer

`^&` and `$T` in doskey behave similar but not same

I want to open a file in cmd and edit it in Sublime Text's specific group, so I create a doskey like this rem version 1, ^& doskey st="path_to\Sublime Text 3\sublime_text" --command "focus_group { \"group\": $1 }" ^& "path_to\Sublime Text…
Animeta
  • 1,241
  • 3
  • 16
  • 30
3
votes
3 answers

How do I call a DOSkey Alias from Powershell?

I have DOSKey Alias that I setup like so (Aliases in Windows command prompt) calling it from the registry, and I'd like to be able to run it from powershell; is there some way to do this? All it really does is add something to the %PATH%…
leeand00
  • 25,510
  • 39
  • 140
  • 297
1
2 3 4