Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Running a program from the command prompt


  • Please log in to reply

#1
dlmgg

dlmgg

    Member

  • Member
  • PipPip
  • 30 posts
Hello,

I work with a software that sends data through Excel. In order for it to work, you need to be able to run Excel from any directory from the command prompt. I have added it to the system path and rebooted with no luck. I also ran a quick test and placed it into system32 to see if that made a difference. They are still not able to start it from anywhere. Am I missing something?

Thanks,
Dawn
  • 0

Advertisements


#2
jt1990

jt1990

    Member 1K

  • Member
  • PipPipPipPip
  • 1,519 posts
Hi there!

In order to do this, you must change the command prompt to the directory that Excel is in. In my case, this is C:\Program Files\Microsoft Office\Office. To change the directory, type:

cd c:\program files\microsoft office\office


It doesn't matter if you use caps or not

Once you are in that directory, you can just type "Excel.exe" (without the quotes) and Excel will open.

Hope this helps! :)
  • 0

#3
dlmgg

dlmgg

    Member

  • Topic Starter
  • Member
  • PipPip
  • 30 posts
Thanks, actually I know I can do that in the directory. What I'm trying to do is be able to start it from any directory. Normally, if you place this in the PATH variable, you can do this but for some reason it will not work for me. For our software to work, I need to be able to start up Excel from anywhere or the software won't find it and it will generate an error message.

Thanks again

Edited by dlmgg, 13 November 2008 - 02:04 PM.

  • 0

#4
jt1990

jt1990

    Member 1K

  • Member
  • PipPipPipPip
  • 1,519 posts
Hmm... I don't know that there is a way to start a program while not in it's directory...Lemme do some research on this...
  • 0

#5
dlmgg

dlmgg

    Member

  • Topic Starter
  • Member
  • PipPip
  • 30 posts
This may be a better explanation:

When a command is issued in Command Prompt, the computer first looks in the current folder for an executable file with the same name and an extension like .exe, .com or .bat. If it doesn't find one there, it then searches in other specified folders. The folders searched, and the order in which they are searched, can be controlled by the path command. For example, the command:

set path=c:\;c:\windows;c:\tools

this means if I type a command (one that is not a standard DOS or Command Prompt command, that is), Command Prompt will first search the root folder (that is, c:\),then the c:\windows folder, and finally the c:\tools folder until it finds an executable program with the same name as my command.

The problem is, it isn't searching those folders in the path. As a test I moved a copy of Excel.exe to the system32 directory and had the same problem.
  • 0

#6
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
well for an environmental variable to work in the command prompt you have to enclose it in % signs....so from the run command you can just do excel (if that's what your variable is named) but if you open up a command prompt you have to do %excel% ...so if your program doesn't issue the command in % signs it's not going to work
  • 0

#7
dlmgg

dlmgg

    Member

  • Topic Starter
  • Member
  • PipPip
  • 30 posts
That's strange, I don't need to add the % on my in house XP machine. Once I verify the PATH var is setup properly, I can drop to the command prompt and from any directory I type excel.exe and off she goes.
  • 0

#8
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
well on mine i can't get the excel variable i made to run from CMD without the % signs....
  • 0

#9
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
actually i take that back....i think i see where you're going...you're not making a new variable you're adding to the path

i put C:\Program Files\Microsoft Office\OFFICE11\ in the path variable (separated from the rest with a ; ) and i can now type excel.exe into any command window and it'll find it
  • 0

#10
dlmgg

dlmgg

    Member

  • Topic Starter
  • Member
  • PipPip
  • 30 posts
Yes, that is exactly what I'm doing and telling my client to do BUT he can't get it to work on his machine and several others.
  • 0

#11
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
....have you been able to verify that the client is actually doing it correctly? can you get a screenshot or something?
  • 0

#12
dlmgg

dlmgg

    Member

  • Topic Starter
  • Member
  • PipPip
  • 30 posts
I logged on earlier today and it looked right at a quick glance but I did email him earlier for a screen capture. Waiting to hear back from him.
  • 0

#13
webdude

webdude

    New Member

  • Member
  • Pip
  • 1 posts
Hey if you want to run a command from anywhere try this

@echo off //This is optional if you dont want to see the caommands running (delete this later)

cd C:\Program Files\Microsoft Office\OFFICE11 // (delete this later) this goes to the file location (put the directory the exe program is in in here)
exel.exe // (delete this later) now run the .exe program here

pause //(delete this later) this is if you want to check it out to see if it worked after it ran
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP