57
questions
0
votes
0
answers
52
views
DOSKEY shortcut for kubectl logs command
I have 3 different apps (my-app-1, my-app-2, my-app-3)
I am trying to add doskey shortcuts for the logs
i.e. for the below command
kubectl logs my-app-1-<SOME_RANDOM_POD_ID>
My intention is to ...
0
votes
1
answer
65
views
Macro comands not excuteing in batch file
i am currently in the process of a project and i want to use DOSKEY commands i have in a bat file, for example run program of change direcorties theses commands all work on in my CLI. just wondering ...
0
votes
1
answer
245
views
WSL alias with doskey not working on Windows
For some commercial reasons, I am no longer allowed to use Docker Desktop on my company's computer. However, I installed the Windows Subsystem for Linux (WSL) for using Docker commands directly within ...
0
votes
0
answers
20
views
cmder alias: use several files as macrofile
I use several configurations in my cmder. So I defined several tasks to be able to run them in specific tab.
Today, I have duplicate cmder\config to cmder\config_1, cmder\config_2 etc. And in each ...
1
vote
1
answer
244
views
Sanitizing command parameters in a DOSKEY macro
Let's say I have the following in my AutoRun script:
@doskey cd = @( ^
for /f usebackq^^ delims^^=^^ eol^^= %%a in (^
'$* ' ^
) do @( ^
if "%%~a"==" " ( ^
...
2
votes
1
answer
1k
views
Get date/time of commands from history on windows (cmd/ps)
https://www.2daygeek.com/display-date-time-linux-bash-history-command/
Found this article which seems to show equivalent how to for linux, using HISTTIMEFORMAT environment variable,
# history
1 ...
0
votes
1
answer
202
views
How do I add a variable to a doskey command that will read the variable after it executes (not get the current variable)
I have this command:
doskey cd = cd /d $* ^&^& echo "You are in: "%cd%
doskey cd = cd /d $* ^&^& title %cd%
When I paste this in CMD it will set the current cd and not ...
1
vote
1
answer
85
views
how to escape findstr /r in a for loop to work in doskey
I have this command
for /F "tokens=2 delims=:" %a in ('ipconfig ^| findstr /R "Default Gateway[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"') do @ping -t %a
this works fine and extracts my ...
1
vote
1
answer
136
views
doskey to print `$env:Path -split ';'` (in PowerShell), except that doesn't work
Entering $env:path at the prompt correctly returns:
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\...
1
vote
1
answer
202
views
`doskey /macros:all` produces quoted string I can't get rid of
First, I'm in PowerShell and I've entered the doskey /exename=powershell.exe option.
Second, I did something that I now realize doesn't quite work:
doskey envpath=$env:Path -split ';'
The goal was ...
1
vote
1
answer
104
views
Windows Batch Files: How can I append to a *.bat or *.cmd file from within itself?
I'm trying to implement a slight modification to the code provided by @Argyll in this SO answer, specifically changing:
DOSKEY alias=notepad %USERPROFILE%\Dropbox\alias.cmd
to:
doskey alias=echo ...
1
vote
0
answers
114
views
How to keep alias setting with doskey in Azure pipeline?
I am using Azure pipeline with Self-hosted Windows agents to run a local script init.cmd, which is mainly for alias setting with doskey. I am using the following YAML file to configure the pipeline
...
2
votes
2
answers
818
views
DOSKEY macros break prompts (SET /P) of batch scripts, when run from within same Windows CMD shell
Yes, it's 2021 and I'm still using the CMD shell and batch scripts for simple tasks.
I just recently tried to enhance my workflow by auto-running my own init-script for (each) CMD prompt session, ...
0
votes
2
answers
185
views
Windows BAT script for cp alias produces error
I wrote a file called cp.bat and the content of this file is: DOSKEY cp=COPY $* copy. I saved this file in c:\users\myname\aliases. I also added this path to my environment so cmd can execute it.
When ...
5
votes
1
answer
4k
views
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 ...
1
vote
1
answer
218
views
How to escape all quotes in $* to pass it to PowerShell from CMD
I experience some problem with executing PowerShell command from CMD.
I have a function MyFunction in PowerShell which takes two parameters: Id and Text.
Example:
MyFunction 12345 "Name = Karl"
I ...
1
vote
2
answers
1k
views
How to make an alias for a function in batch?
I want to create an alias for a function in batch something like this:
echo off
DOSKEY getMessage=call :message
:message
SET answer=
SET /P answer=What is your message? :
IF EXIST %answer% (
...
2
votes
1
answer
258
views
Why %cd% set in doskey alias script returns script path instead of the current directory
I am setting an alias file in %userprofile%\alias.cmd containing basic DOSKEY cmd:
@echo off
DOSKEY ls=dir
DOSKEY clear=cls
DOSKEY pwd=echo %cd%
I am installing alias.cmd in HKEY_LOCAL_MACHINE\...
3
votes
1
answer
500
views
`^&` 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 {...
1
vote
1
answer
1k
views
How to create a DOSKEY alias command to print Windows %PATH% with every entry on new line?
I have the same task as Print Windows %PATH% with every entry on new line
I have a task: print all entries of %PATH% variable on new line. For example:
C:\Program Files\
C:\Windows
C:\Windows\...
0
votes
0
answers
143
views
Text expansion in Cmder / ConEMU
A long time ago, I set my Cmder (ConEMU) to expand "~" to C:\Users\%USERNAME%.
Embarrassingly, I have forgotten how I did it.
Now I'd like to un-do it.
I've checked my alias files and ran "...
4
votes
3
answers
2k
views
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 ...
1
vote
1
answer
289
views
How to add a post-fix to a DOSKEY [CMD]
I would like a prefix to run a command but slightly differently, for example
openlink (opens the link)
Then I would like to be able to say open it 2 times by using a prefix, for example
openlink *2 ...
2
votes
1
answer
449
views
Use alias to run a loop
I would like to be able to manually type an 'alias' keyword into the command console and have it execute the following command a specified number of times.
taskkill /PID "%PID%" /f >nul 2>&...
1
vote
1
answer
939
views
Add single doskey command - Windows Registry
I'm working on a batch file, and I need to add this entry:
doskey wfreerdp="C:\Program Files\wfreerdp\wfreerdp.exe" $*
to this regkey:
HKCU\Software\Microsoft\Command Processor
I played with the ...
4
votes
1
answer
1k
views
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 ...
3
votes
3
answers
2k
views
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 ...
25
votes
8
answers
201k
views
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 ...
16
votes
4
answers
10k
views
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 ...
1
vote
1
answer
428
views
Removing quotes from doskey macro (export=set)
I'm trying to remove incoming quotes for a doskey macro that will let me use "export" as "set". Here's what I have:
doskey export=set $*
Except when I run with the following:
export VAR="value"
I ...
1
vote
1
answer
3k
views
Print all existing doskeys
Windows uses doskey to do something like Unix's alias. To display all existing Unix aliases I can simply type alias with no arguments. However, on Windows, typing doskey with no arguments does nothing....
6
votes
1
answer
5k
views
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 /...
1
vote
1
answer
517
views
The doskey command separator produces blank lines
The doskey command separator ($T) generates a blank line when the command produces no output.
C:\> set "a="
C:\> set "b=" ...
6
votes
1
answer
2k
views
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 ...
0
votes
1
answer
431
views
How do I set the value of multiple variables in a macro in batch?
I am writing a script template to install multiple MSI's, including error logging and a rollback function. It contains scriptblocks to store install and uninstall information of each MSI.
@ECHO OFF
...
7
votes
2
answers
6k
views
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 --...
3
votes
2
answers
2k
views
mkdir && cd windows alias
I am trying to make a directory and immediately change into it with a DOSKEY. I thought this would work but it gives me the error The filename, directory name, or volume label syntax is incorrect.
...
0
votes
0
answers
132
views
Linking DOSKEYS in the Terminal
I have written some short DOSKEYS that I've got in a .bat file. I have one that let's me run a python program from any directory as long as i know the python file's directory and I have one that lets ...
0
votes
1
answer
347
views
How can I create a short command to launch a browser (Internet Explorer is what I'll use) running as another account
I would like to start Internet Explorer as a different user through a command line alias. I liked the approach of using an AutoRun registry setting to call an environment setting script.
So I have ...
0
votes
2
answers
5k
views
Get IP address on Windows 7 via command line
I have a list of aliases defined in a command file (aliases.cmd) that I load whenver I run a command prompt (cmd.exe /k aliases.cmd). Using doskey, I have several aliases defined and I am trying to ...
1
vote
1
answer
2k
views
Run alias command from command prompt in new command prompt
So I've set up a file with some aliases for commands that I commonly use. I added it to the registry like in this answer.
I want to use this alias like so:
>cmd /k newalias
'newalias' is not ...
0
votes
1
answer
747
views
How to add several values for a single key in Windows Registry
I'm trying to add an entry for AutoRun with value doskey selenium=java -jar C:\dev\selenium-server-standalone-2.45.0.jar to HKEY_CURRENT_USER\Software\Microsoft\Command Processor. However the AutoRun ...
1
vote
1
answer
502
views
Setup windows doskey for echo > filename.txt
My goal is to setup doskey to imitate unix touch command as touch filename.txt
Without doskey I use echo . > filename.txt in the windows's command prompt
I successfully setup doskey touch=echo $* ...
0
votes
1
answer
3k
views
How to detect Down and Up Arrow Keys While DridGridView is in Edit Mode
I'm working with a DataGridView in vb.net which populating a listbox while editing. How ever I'm trying to move the focus to the listbox by pressing the down arrow key. But the default down arrow key ...
2
votes
1
answer
117
views
cmd alias for printing out sizeof folder cygwin
I currently try to figure out How exactly i can generate a Doskey Alias that allows Pipes.
I want to gather the foldersize in kB.
I have tried
alias dirsize=du -P -c -a -b $1 | grep total | awk '...
1
vote
1
answer
3k
views
Windows cmd executing multiple doskey macros with &&
In my Linux development environment I have become accustomed to building and deploying my code in one line commands, for example:
mvn clean package && ./deploy.sh localhost
I have written ...
5
votes
1
answer
1k
views
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? -> ...
1
vote
2
answers
878
views
windows cmd(clink) doskey, how to copy the current directory to clipboard, prepended by "cd"?
It is ok to do this in the command line:
C:\Users\ken.chen>echo|set /p=cd %cd%|clip
C:\Users\ken.chen>cd C:\Users\ken.chen
C:\Users\ken.chen\nuts\notes>echo|set /p=cd %cd%|clip
C:\Users\...
0
votes
1
answer
349
views
Using doskey to spawn multiple instances of explorer
So I'm trying to create a Doskey alias to spawn 3 instances of windows explorer, opening 3 different directories.
I have my cmd.exe shortcut set up to read from file.cmd which has the following ...
0
votes
1
answer
1k
views
From bat - open cmd, load doskey macros, and execute a macro
Is it possible to use cmd /k "doskey /macrofile=C:\myMacros.cmd && macroCommand" from a bat file.
I have tried that as well as start cmd.exe /k "doskey /macrofile=C:\myMacros.cmd && ...