Jump to content

How to run an exe with command-line switches?


prp2
 Share

Recommended Posts

Hello folks,

I'm trying to run a program that takes some command-line switches to force an installation over a current one. If I just run the program as-is it works fine, but when I try to run it with the switch, it doesn't seem to be accepting it and just runs normally.

What I've done so far is:

Run (@TempDir & '\prog.exe')

That just runs it as-is, with no switches.

But when I try:

Run (@TempDir & '\prog.exe /force')

That also just runs it as-is, as if I didn't use a switch.

Lastly I tried:

Run (@TempDir & '\prog.exe' & '/force')

I didn't really expect that one to work, and it didn't, saying it couldn't find the program to run.

Am I doing something wrong?

Link to comment
Share on other sites

Hello folks,

I'm trying to run a program that takes some command-line switches to force an installation over a current one. If I just run the program as-is it works fine, but when I try to run it with the switch, it doesn't seem to be accepting it and just runs normally.

What I've done so far is:

Run (@TempDir & '\prog.exe')

That just runs it as-is, with no switches.

But when I try:

Run (@TempDir & '\prog.exe /force')

That also just runs it as-is, as if I didn't use a switch.

Lastly I tried:

Run (@TempDir & '\prog.exe' & '/force')

I didn't really expect that one to work, and it didn't, saying it couldn't find the program to run.

Am I doing something wrong?

Not sure about the issue with the force switch for your particular app, but the last example you gave would need another space inside your quotes, because right now it would end up passing \prog.exe/force. Other than that your syntax looks fine.

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Ahh, as it turns out, the /force flag I was using doesn't do exactly that. It does reinstall files over existing ones, but it also prompts the user for settings. I ended up using an If...Then...Else for it. Seems to work well enough now. Thanks for the help. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...