1

Ok, so I know to run an .exe in batch you use START. However, let me explain how the .exe works.

Let's say I have it in C:\, and it's called uptime.exe.

I would go to Run and bring up cmd and navigate to C: then type into CMD the following: uptime.exe computername.

However, to run it, I always have to go through those steps of going into cmd prompt and typing in uptime.exe computername.

I wanted to create a batch file that would prompt the username and attach that to starting the .exe but my attempts have failed.

This is what I have:

@echo off
color 0E
:start
SET /P pcname=Type in Computer's Name: 
echo.
start "c:\windows\system32" uptime.exe /%pcname%
echo.
ECHO Press any key to close this window.
pause>nul
2
  • 2
    What result are you expecting and what result are you receiving? Commented Dec 5, 2013 at 22:24
  • Also, is there any reason you need the :start label? Commented Dec 5, 2013 at 23:03

1 Answer 1

1

start "Some title - may be empty" "c:\windows\system32\uptime.exe" /%pcname%

should get you off the ground. I've assumed that uptime.exe is in c:\windows\system32, but you say it's in c:\ - which is confusing.

start "Some title - may be empty" "c:\uptime.exe" /%pcname%

would be the case if uptime.exe truly is in c:\

if uptime.exe is somewhere on the path then

start "Some title - may be empty" uptime.exe /%pcname%

is all that is required - and the quoted parameter becomes optional.

To see PATH, simply type path at the prompt. The path variable contains a ;-separated sequence of directorynames which are searched in order when the system wants to find an executable that isn't in the current (aka "logged") directory.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.