Jump to content



Photo

Run CMD with a Command?


  • Please log in to reply
3 replies to this topic

#1 Sir Topham Hatt

Sir Topham Hatt

    A Very Talented Individual

  • Tech Issues Solved: 1
  • Joined: 02-November 03
  • Location: Island of Sodor, UK

Posted 11 March 2013 - 09:25

Hi

I've had a lok on the internet and been unable to find the simple answer to this.

How can I create a shortcut to CMD which when opened will run a command? Obviously I know how to create shortcuts, but getting it to run a command when I've opened it is the problem.

Thanks


#2 Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 11 March 2013 - 09:32

what is the command?

just create a batch file

so create a file called myfile.bat

and in there put your command

#3 Bonfire

Bonfire

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 08-August 05
  • Phone: Rotary Dial

Posted 11 March 2013 - 09:36

Make a shortcut to cmd.exe and then add /k followed by your command in quotes.

For example to have it open in your Windows directory use the following shortcut:

cmd.exe /k "cd /d c:\windows"

#4 OP Sir Topham Hatt

Sir Topham Hatt

    A Very Talented Individual

  • Tech Issues Solved: 1
  • Joined: 02-November 03
  • Location: Island of Sodor, UK

Posted 11 March 2013 - 10:11

Hmm, the shortcut I have already has a /k:
C:\Windows\System32\cmd.exe /k NAMEOFPROG.cmd --search dontshowanymatches && NAMEOFPROG.cmd --help

However the command line seems to be playing ball at the moment so I can just hit up to change the command to what I need. I can't really explain fully the program or command line as I suspect it is a grey area, although not illegal.

I wouldn't know how to merge the above in a batch file though. The command I need to run is similar to:

NAMEOFPROG --get XXX --output /Folder --TESTmode=flashhd,flashvhigh