2

I want to program in Perl a very basic program but I'm having some questions about how to do it. I'll keep it simple: I want a perl script that when number 1 is pressed a new "cmd.exe" is opened and the "dir" command is executed, and when 2 is pressed a new "cmd.exe" is opened and the command "cd" is executed.

The place where I'm having the problems is in opening a NEW "cmd.exe" instead of the same cmd that executes the perl script.

Some ideas? Thanks a lot

Axeman
  • 29,660
  • 2
  • 47
  • 102
user354427
  • 195
  • 4
  • 13
  • 1
    Firstly I don't see the point of doing this. Secondly it'd be nice if you explained *how* you're trying to do this and your current results. – gamen Aug 24 '10 at 11:15
  • Possible duplicate: http://stackoverflow.com/questions/303838/create-a-new-cmd-exe-window-from-within-another-cmd-exe-prompt – Mike Aug 24 '10 at 12:30

1 Answers1

2

If i understand it correct,what you want is to open a new window of cmd.exe and want to execute dir or cd command.is it? Then i think you can use following command to get it donw

start cmd /K dir this command will execute "dir" command but won't close the new command window...

start cmd /C dir this command will execute the dir command and terminate the new command window.

Anil Vishnoi
  • 1,352
  • 3
  • 18
  • 25
  • Anil, you have understood perfectly. It works great! Thank you. – user354427 Aug 24 '10 at 13:30
  • @user354427 You haven't replied to @gamen question as i am also willing to know how you are trying. Any way, if you are satisfy with answer given by @Anil then pl. accept it – ppant Aug 24 '10 at 13:41