Set placeholder command in cmd at start shell without executing the command automatically [duplicate]
This question already has an answer here:
How can I run cmd from batch file and add text to line without executing?
4 answers
I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello
) and the user only need to press enter instead of typing it.
Is this possible? I found the /k
switch like cmd /k echo hello
but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello"
but this is not very transparent as the user doesn't know what got executed.
batch-file cmd windows-10
marked as duplicate by Squashman, Aacini
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 14:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How can I run cmd from batch file and add text to line without executing?
4 answers
I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello
) and the user only need to press enter instead of typing it.
Is this possible? I found the /k
switch like cmd /k echo hello
but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello"
but this is not very transparent as the user doesn't know what got executed.
batch-file cmd windows-10
marked as duplicate by Squashman, Aacini
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 14:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How can I run cmd from batch file and add text to line without executing?
4 answers
I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello
) and the user only need to press enter instead of typing it.
Is this possible? I found the /k
switch like cmd /k echo hello
but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello"
but this is not very transparent as the user doesn't know what got executed.
batch-file cmd windows-10
This question already has an answer here:
How can I run cmd from batch file and add text to line without executing?
4 answers
I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello
) and the user only need to press enter instead of typing it.
Is this possible? I found the /k
switch like cmd /k echo hello
but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello"
but this is not very transparent as the user doesn't know what got executed.
This question already has an answer here:
How can I run cmd from batch file and add text to line without executing?
4 answers
batch-file cmd windows-10
batch-file cmd windows-10
asked Nov 16 '18 at 9:27
DanielDaniel
107111
107111
marked as duplicate by Squashman, Aacini
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 14:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Squashman, Aacini
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 14:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
So there are 2 ways of doing this:
Create a shortcut.
Right click in a folder where you want to store the shortcut
Select new Shortcut
In the command window, type the following:
cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost
Click next and give it a name and save.
Now you can double click the file and it will print to screen:
press Enter to continue ping localhost command
when Enter is pressed, it will ping localhost
Batch File
Open notepad.exe
Type the following
@echo off
echo press Enter to continue ping localhost command
pause >nul
ping localhost
pause
Save the file to the desired location and give it a
.cmd
extension
Now you can double click the file and it will do the same as the previously created shortcut version.
As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.
@echo off
echo echo hello
pause >nul
echo hello
echo ping localhost
pause >nul
ping localhost
pause..
this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.
Similarly with the shortcut version:
cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So there are 2 ways of doing this:
Create a shortcut.
Right click in a folder where you want to store the shortcut
Select new Shortcut
In the command window, type the following:
cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost
Click next and give it a name and save.
Now you can double click the file and it will print to screen:
press Enter to continue ping localhost command
when Enter is pressed, it will ping localhost
Batch File
Open notepad.exe
Type the following
@echo off
echo press Enter to continue ping localhost command
pause >nul
ping localhost
pause
Save the file to the desired location and give it a
.cmd
extension
Now you can double click the file and it will do the same as the previously created shortcut version.
As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.
@echo off
echo echo hello
pause >nul
echo hello
echo ping localhost
pause >nul
ping localhost
pause..
this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.
Similarly with the shortcut version:
cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost
add a comment |
So there are 2 ways of doing this:
Create a shortcut.
Right click in a folder where you want to store the shortcut
Select new Shortcut
In the command window, type the following:
cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost
Click next and give it a name and save.
Now you can double click the file and it will print to screen:
press Enter to continue ping localhost command
when Enter is pressed, it will ping localhost
Batch File
Open notepad.exe
Type the following
@echo off
echo press Enter to continue ping localhost command
pause >nul
ping localhost
pause
Save the file to the desired location and give it a
.cmd
extension
Now you can double click the file and it will do the same as the previously created shortcut version.
As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.
@echo off
echo echo hello
pause >nul
echo hello
echo ping localhost
pause >nul
ping localhost
pause..
this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.
Similarly with the shortcut version:
cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost
add a comment |
So there are 2 ways of doing this:
Create a shortcut.
Right click in a folder where you want to store the shortcut
Select new Shortcut
In the command window, type the following:
cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost
Click next and give it a name and save.
Now you can double click the file and it will print to screen:
press Enter to continue ping localhost command
when Enter is pressed, it will ping localhost
Batch File
Open notepad.exe
Type the following
@echo off
echo press Enter to continue ping localhost command
pause >nul
ping localhost
pause
Save the file to the desired location and give it a
.cmd
extension
Now you can double click the file and it will do the same as the previously created shortcut version.
As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.
@echo off
echo echo hello
pause >nul
echo hello
echo ping localhost
pause >nul
ping localhost
pause..
this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.
Similarly with the shortcut version:
cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost
So there are 2 ways of doing this:
Create a shortcut.
Right click in a folder where you want to store the shortcut
Select new Shortcut
In the command window, type the following:
cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost
Click next and give it a name and save.
Now you can double click the file and it will print to screen:
press Enter to continue ping localhost command
when Enter is pressed, it will ping localhost
Batch File
Open notepad.exe
Type the following
@echo off
echo press Enter to continue ping localhost command
pause >nul
ping localhost
pause
Save the file to the desired location and give it a
.cmd
extension
Now you can double click the file and it will do the same as the previously created shortcut version.
As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.
@echo off
echo echo hello
pause >nul
echo hello
echo ping localhost
pause >nul
ping localhost
pause..
this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.
Similarly with the shortcut version:
cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost
edited Nov 16 '18 at 10:05
answered Nov 16 '18 at 9:49
Gerhard BarnardGerhard Barnard
9,23231233
9,23231233
add a comment |
add a comment |