runas: I can't invoke system commands
This works:
$ C:UsersGuest> runas /user:Administrator cmd
Executes a new cmd.exe process/window as Administrator
However using commands like type, cd, echo, dir, etc won't work:
$ C:UsersGuest> runas /user:Administrator type
$ C:UsersGuest> runas /user:Administrator cd
$ C:UsersGuest>
$ C:UsersGuest> echo "hello" > test
$ C:UsersGuest> runas /user:Administrator "type C:UsersGuesttest"
all of the above give the same error:
RUNAS ERROR: Unable to run - type C:UsersGuesttest
2: The system can not find the file specified

windows command-line runas
add a comment |
This works:
$ C:UsersGuest> runas /user:Administrator cmd
Executes a new cmd.exe process/window as Administrator
However using commands like type, cd, echo, dir, etc won't work:
$ C:UsersGuest> runas /user:Administrator type
$ C:UsersGuest> runas /user:Administrator cd
$ C:UsersGuest>
$ C:UsersGuest> echo "hello" > test
$ C:UsersGuest> runas /user:Administrator "type C:UsersGuesttest"
all of the above give the same error:
RUNAS ERROR: Unable to run - type C:UsersGuesttest
2: The system can not find the file specified

windows command-line runas
add a comment |
This works:
$ C:UsersGuest> runas /user:Administrator cmd
Executes a new cmd.exe process/window as Administrator
However using commands like type, cd, echo, dir, etc won't work:
$ C:UsersGuest> runas /user:Administrator type
$ C:UsersGuest> runas /user:Administrator cd
$ C:UsersGuest>
$ C:UsersGuest> echo "hello" > test
$ C:UsersGuest> runas /user:Administrator "type C:UsersGuesttest"
all of the above give the same error:
RUNAS ERROR: Unable to run - type C:UsersGuesttest
2: The system can not find the file specified

windows command-line runas
This works:
$ C:UsersGuest> runas /user:Administrator cmd
Executes a new cmd.exe process/window as Administrator
However using commands like type, cd, echo, dir, etc won't work:
$ C:UsersGuest> runas /user:Administrator type
$ C:UsersGuest> runas /user:Administrator cd
$ C:UsersGuest>
$ C:UsersGuest> echo "hello" > test
$ C:UsersGuest> runas /user:Administrator "type C:UsersGuesttest"
all of the above give the same error:
RUNAS ERROR: Unable to run - type C:UsersGuesttest
2: The system can not find the file specified

windows command-line runas
windows command-line runas
edited Jan 28 at 18:34
chefarov
asked Jan 28 at 17:48
chefarovchefarov
1084
1084
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
That is because type and cd are internal commands of the command interpreter, cmd.exe.
Use
$ C:UsersGuest> runas /user:Administrator "cmd /c type "C:UsersGuesttest""
You could call the cd command the same way, but there is no point calling cd in a process that will terminate immediately.
Thanks. I managed to usecdin this way:RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator"however it spawns a new shell that way
– chefarov
Jan 28 at 19:25
1
That is the purpose of the/Koption and the only reason to use aCDcommand, because the shell process doesn't exit immediately.
– RalfFriedl
Jan 28 at 19:51
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399359%2frunas-i-cant-invoke-system-commands%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
That is because type and cd are internal commands of the command interpreter, cmd.exe.
Use
$ C:UsersGuest> runas /user:Administrator "cmd /c type "C:UsersGuesttest""
You could call the cd command the same way, but there is no point calling cd in a process that will terminate immediately.
Thanks. I managed to usecdin this way:RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator"however it spawns a new shell that way
– chefarov
Jan 28 at 19:25
1
That is the purpose of the/Koption and the only reason to use aCDcommand, because the shell process doesn't exit immediately.
– RalfFriedl
Jan 28 at 19:51
add a comment |
That is because type and cd are internal commands of the command interpreter, cmd.exe.
Use
$ C:UsersGuest> runas /user:Administrator "cmd /c type "C:UsersGuesttest""
You could call the cd command the same way, but there is no point calling cd in a process that will terminate immediately.
Thanks. I managed to usecdin this way:RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator"however it spawns a new shell that way
– chefarov
Jan 28 at 19:25
1
That is the purpose of the/Koption and the only reason to use aCDcommand, because the shell process doesn't exit immediately.
– RalfFriedl
Jan 28 at 19:51
add a comment |
That is because type and cd are internal commands of the command interpreter, cmd.exe.
Use
$ C:UsersGuest> runas /user:Administrator "cmd /c type "C:UsersGuesttest""
You could call the cd command the same way, but there is no point calling cd in a process that will terminate immediately.
That is because type and cd are internal commands of the command interpreter, cmd.exe.
Use
$ C:UsersGuest> runas /user:Administrator "cmd /c type "C:UsersGuesttest""
You could call the cd command the same way, but there is no point calling cd in a process that will terminate immediately.
answered Jan 28 at 18:31
RalfFriedlRalfFriedl
1,128147
1,128147
Thanks. I managed to usecdin this way:RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator"however it spawns a new shell that way
– chefarov
Jan 28 at 19:25
1
That is the purpose of the/Koption and the only reason to use aCDcommand, because the shell process doesn't exit immediately.
– RalfFriedl
Jan 28 at 19:51
add a comment |
Thanks. I managed to usecdin this way:RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator"however it spawns a new shell that way
– chefarov
Jan 28 at 19:25
1
That is the purpose of the/Koption and the only reason to use aCDcommand, because the shell process doesn't exit immediately.
– RalfFriedl
Jan 28 at 19:51
Thanks. I managed to use
cd in this way: RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator" however it spawns a new shell that way– chefarov
Jan 28 at 19:25
Thanks. I managed to use
cd in this way: RUNAS /user:Administrator "CMD /K CD C:UsersAdministrator" however it spawns a new shell that way– chefarov
Jan 28 at 19:25
1
1
That is the purpose of the
/K option and the only reason to use a CD command, because the shell process doesn't exit immediately.– RalfFriedl
Jan 28 at 19:51
That is the purpose of the
/K option and the only reason to use a CD command, because the shell process doesn't exit immediately.– RalfFriedl
Jan 28 at 19:51
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399359%2frunas-i-cant-invoke-system-commands%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown