Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[solved] Trouble with Run command



  • Please log in to reply
6 replies to this topic
mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008
Hi all, I'm having trouble with the Run command.

This command works at the command line, and has the desired output, which is a text file named "output1.txt":
run spamassassin -t < test.eml > output1.txt

The same command also works as a .bat file.

However, when I try to use ahk to run the command, the command appears to not be working ,as the text file "output1.txt" is not generated. This is what I have tried in ahk, but with no luck:

The full command, without quotes:
run spamassassin -t < test.eml > output1.txt

The full command, without quotes, adding ".exe":
run spamassassin.exe -t < test.eml > output1.txt

The full command, without quotes, adding the path to the exe:
run C:\ahk\Email Tester\MailingCheck\spamassassin\spamassassin.exe -t < test.eml > output1.txt

The full command, enclosed in quotes:
run "spamassassin -t < test.eml > output1.txt" (immediate ahk error)

The command split up with the file to run, and parameters:
run "spamassassin" "-t < test.eml > output1.txt"

The command split up with the file to run, with .exe added, and parameters:
run "spamassassin.exe" "-t < test.eml > output1.txt"

The command split up with the file to run, with full path, and parameters:
run "C:\ahk\Email Tester\MailingCheck\spamassassin\spamassassin.exe" "-t < test.eml > output1.txt"

Any suggestions would be greatly appreciated. Thank you.

- Mike

Odlanir
  • Members
  • 775 posts
  • Last active: Mar 06 2014 11:02 AM
  • Joined: 07 Aug 2011
As far as I know a command like this:

run spamassassin -t < test.eml > output1.txt

it means:

Run a .exe (or .bat ) program called spamassassin with option -t reading input from a file named test.eml and writing output in a file called output1.txt.


The program could be in any folder included in your environment path but the input and the output files should and will be in your current directory.
So, I suggest you to look if the current directory is correct.
Win7 - Firefox 10.0.2 - AHK_L 1.1.07.00
Please bear with me and my English which is so bad at times that even I don't understand myself

mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008

The program could be in any folder included in your environment path but the input and the output files should and will be in your current directory.
So, I suggest you to look if the current directory is correct.


Hi Odlanir, thank you for your response. The ahk script, "runtest.ahk" is in the same directory as "spamassassin.exe" and "test.eml". With this in mind, I believe that the current directory is correct.

- Mike

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
✓  Best Answer
Actually, it means run spamassassin with the arguments "-t < test.eml > output1.txt". The meta-characters "<" and ">" are normally interpreted by cmd.exe, not spamassassin. Try this:
run %ComSpec% /c spamassassin -t < test.eml > output1.txt


mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008

Actually, it means run spamassassin with the arguments "-t < test.eml > output1.txt". The meta-characters "<" and ">" are normally interpreted by cmd.exe, not spamassassin. Try this:

run %ComSpec% /c spamassassin -t < test.eml > output1.txt

That works, Lexikos. Thank you!

If you have a moment, could you explain what /c does?

- Mike

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
It makes the command window exit when finished. Changing it for /k leaves an interactive cmd prompt open.

mikek
  • Members
  • 161 posts
  • Last active: Nov 09 2015 05:02 PM
  • Joined: 21 Nov 2008

It makes the command window exit when finished. Changing it for /k leaves an interactive cmd prompt open.

Thank you, nimda, I appreciate it.

- Mike