Solved CMD starts script in new window

June 26, 2012 at 22:02:28
Specs: Windows XP
runas /user:jimmy@server cmd
echo 10
\\server\file\file\file\price_is_right.exe
echo 10
explorer \\server\everyone_knows

when i run this command it runs flawlessly but the problem i am having is when i type my password in for my admin when i am a user it opens a new window and in the old window it starts the other 2 scripts.

My questions is how do i get it to run in the new window that has my new cmd window running as admin run those 2nd script?

I have tried call but it still does that command in the old window witch doesn't help me because i can only run this as an administrator on my server. How do i do this


See More: CMD starts script in new window

Report •


✔ Best Answer
June 27, 2012 at 19:35:19
I tried Tony's method on my xp, but re-arranged and added quotes, and got no problem with the intended console:
runas /user:lee "cmd.exe /q /c a.bat & g.bat"
it requested password, which I allow blank, went to child-console, did the dirt, and exited. I did have problem with runas administrator, but I think that's just some security bs that I haven't sorted out.


#1
June 27, 2012 at 05:48:20
I'm not sure I understand the situation described. Are you using RUNAS to access a file on a server? Because if that's the case, just use NET USE to create a network session with that server with the desired account.

How To Ask Questions The Smart Way


Report •

#2
June 27, 2012 at 08:20:16
You mean like this?

runas /user:jimmy@server cmd /c /q & echo 10 & \\server\file\file\file\price_is_right.exe & echo 10 & explorer \\server\everyone_knows

Razor, what I think he means is that all the output of the commands after the runas is being shown in the calling processes windows rather than the new cmd process started by runas.

Tony


Report •

#3
June 27, 2012 at 13:22:18
sathre is correct it runs the rest of the process in the old window instead of the new runas window

Report •

Related Solutions

#4
June 27, 2012 at 13:29:09
Tony i tried the cmd you wrote but it didnt work it did not ask me for my password it just ran the command as the normal user not as my admin

Report •

#5
June 27, 2012 at 19:35:19
✔ Best Answer
I tried Tony's method on my xp, but re-arranged and added quotes, and got no problem with the intended console:
runas /user:lee "cmd.exe /q /c a.bat & g.bat"
it requested password, which I allow blank, went to child-console, did the dirt, and exited. I did have problem with runas administrator, but I think that's just some security bs that I haven't sorted out.

Report •

#6
June 29, 2012 at 09:49:44
nbrane you are great it worked perfect now the only thing is when i go onto our sharedrive here i am unable to set permissions when i use the command it doesnt want to work the script i use: explorer \\server\sharedrive

Report •

#7
July 1, 2012 at 12:06:44
I'm not sure what you mean. Content of the (batch) script file you're trying to run would be helpful. Is it just: explorer \\server\sharedrive, or is it something you're trying to run or do from within "explorer" like change folder permissions? I'm not clear enough on exactly what you're trying to do to be of much help... sorry.

Report •

#8
July 5, 2012 at 07:47:43
yes it is folder permissions threw explorer that i am trying to do but it still doesnt let me when i use runas command

Report •


Ask Question