Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Command Prompt

20 May 2011   #1
wave407

Windows 7 Home Premium 64bit
 
 
Command Prompt

Ok so every time I try to open the command prompt using an external source (batch file, small c++ program i made to say Hi to me through the command prompt) it instantly closes. Does anyone have any idea why this is happening and if so how can I fix it?

Thanks,
Wave


My System SpecsSystem Spec
.
20 May 2011   #2
ryo

 
 

hi and welcome,
maybe your script error?
and for what you have to make like that???
My System SpecsSystem Spec
20 May 2011   #3
kado897

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bit Service Pack 1
 
 

You can also make the cmd widow stay open with the /k switch

-capture.jpg


My System SpecsSystem Spec
.

20 May 2011   #4
FliGi7

XP / Win7 x64 Pro
 
 

That sounds about right. If you launch cmd from a script it won't stay open unless you have a pause built-in or it's waiting for input. The fix is in your programming.
My System SpecsSystem Spec
20 May 2011   #5
TCG

 
 

Quote   Quote: Originally Posted by FliGi7 View Post
That sounds about right. If you launch cmd from a script it won't stay open unless you have a pause built-in or it's waiting for input. The fix is in your programming.
Indeed. This is normal behavior.

An alternative would be to run the batch file from an already open command prompt window if you'd like to see the output without changing the script in any way. Easiest solution would be to add a pause on the last line of your batch file.
My System SpecsSystem Spec
20 May 2011   #6
Bare Foot Kid
Microsoft MVP

W 7 64-bit Ultimate
 
 

Hello wave407, welcome to Seven Forums!



I use the method outlined in this tutorial at the link below to add a shortcut to the desktop that opens an elevated command window with one click.


Elevated Program Shortcut without UAC Prompt - Create
click to enlarge
-task_cmd.jpg



My System SpecsSystem Spec
20 May 2011   #7
wave407

Windows 7 Home Premium 64bit
 
 

See that is why i am confused...I do have a pause built in to my hello message and the batch file I'm trying to use I didn't make but I tried it on my other computer and it opens up and stays open
My System SpecsSystem Spec
20 May 2011   #8
TCG

 
 

Try running the batch file from an already opened command prompt, this should at least spit out the output so you can see it, and hopefully an error of some sort telling you what is wrong.
My System SpecsSystem Spec
20 May 2011   #9
wave407

Windows 7 Home Premium 64bit
 
 

ok i figured it out...Thanks guys I really appreciate it
My System SpecsSystem Spec
20 May 2011   #10
kado897

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bit Service Pack 1
 
 

You are welcome. Would you care to share the solution with us to help others?
My System SpecsSystem Spec
Reply

 Command Prompt




Thread Tools




Similar help and support threads
Thread Forum
Command Prompt command <ipconfig> not working
when I open up my command prompt and type 'ipconfig' without the ' and press enter it returns the line: 'ipconfig' is nto recognized as an internal or external command, operable program, or batch file I am trying to find out the information I need in order to set up a static IP Address for port...
Network & Sharing
How to fix MBR through command prompt?
Question: What commands could I run in the command prompt during the system recovery? I try & run say "fixmbr" but it doesn't work. Say if I want to write a new master boot record how would I do that?
General Discussion
Command Prompt
How to Open a Command Prompt in Windows 7 This will show you how to open only a non-elevated a command prompt without administrator rights instead of an elevated command prompt with administrator rights (Run as administrator) in Windows 7. Some commands will need to be used in an elevated...
Tutorials
SSH command prompt
Is there any way I can use ssh or something similar to enter command line prompts from my Mac terminal, similar to SSH but windows commands? (From mac to a windows 7 desktop)
Performance & Maintenance
Run administrative command prompt from command prompt
Ok So I got myself into a unique bind here. I was trying to install some custom system files (for a theme) and I did it wrong and now I cant open explorer.exe . I dont want to goto a backup because this is a easy fix. (in my view). So I need to know how to run command prompt with administrative...
General Discussion
command prompt bug ?
Hi, I just tryed to use cmd as usual but it seems that I can't explore an other HDD than C: It bugs me I don't understand why i'm the only user on my computer and I am admin on it I at home so it should work but when I type "cd d:" I get that : ...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 15:36.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App