Nead a script to run a DOS program

A

Academia

I have a DOS program, Tiny.exe

I'd like to add a shortcut to the Start menu that opens a Command prompt
window containing text pointing to that program.

That is, when I click the shortcut I'd like a Command window to open showing
C:program Files\Tidy.exe

so I can then type the options and filename and then run Tidy

Can you give me a reference to a script that I can put in a file and so a
shortcut to it accomplishes the above?


Thanks for any help
 
P

Pegasus \(MVP\)

Academia said:
I have a DOS program, Tiny.exe

I'd like to add a shortcut to the Start menu that opens a Command prompt
window containing text pointing to that program.

That is, when I click the shortcut I'd like a Command window to open
showing


so I can then type the options and filename and then run Tidy

Can you give me a reference to a script that I can put in a file and so a
shortcut to it accomplishes the above?


Thanks for any help

Create a shortcut on your desktop to Tidy.exe, then specify
"c:\Program Files" as the "Start in" folder.
 
A

Academia

I don't want it to actually run Tidy when I click the shortcut, but rather
to open a Command window with the text "C:program Files\Tidy.exe" in it so I
can add the filename that Tidy will work on, and then press Enter to run
Tidy.

thanks
 
P

Pegasus \(MVP\)

You could do this with a macro that generates key strokes
but a more robust way would be to invoke the batch file
below via a desktop shortcut:

@echo off
set Target=c:\Program Files

:Again
set /p name=Please enter a file name for the Tidy program:
if "%name%"=="" goto Exit
if exist "%Target%\%name%" goto Action
echo Cannot locate "%Target%\%name%".
echo.
goto again

:Action
cd /d "%Target%"
"%Target%\Tidy.exe" "%Target%\%name%"

:Exit
echo.
echo Press the Space Bar to close this window.
pause > nul
 
E

Elmo

Academia said:
I don't want it to actually run Tidy when I click the shortcut, but rather
to open a Command window with the text "C:program Files\Tidy.exe" in it so I
can add the filename that Tidy will work on, and then press Enter to run
Tidy.

thanks

Try adding Tidy.exe (or Tiny.exe) to the Sendto folder. Then
right-click the file you want to edit(?) and click Send To, Tidy.exe or
place Tid(n)y.exe on the Desktop, and drag/drop the other file onto it.

Couldn't hurt to try these..
 
A

Academia

Great
Not exactly what I wanted.
I changed the first set to:
set /p Target=enter the path to the files:
Didn't really know what I was doing but duplicated your second set and it
worked.
Tried to find documentation on "set" by searching Help for it but didn't
find it.
Are these commands documented someplace?
For example, don't know what "/p" does.

I was playing with a shortcut file with the target cmd or command, and the
folder the location of tidy. Like you approach much better.

What is the difference between command and cmd?


It appears that you took the time to write the code just to answer my query.
I really appreciate it
thanks
 
A

Academia

That's an idea

thanks

Elmo said:
Try adding Tidy.exe (or Tiny.exe) to the Sendto folder. Then right-click
the file you want to edit(?) and click Send To, Tidy.exe or place
Tid(n)y.exe on the Desktop, and drag/drop the other file onto it.

Couldn't hurt to try these..
 
P

Pegasus \(MVP\)

You can find help for just about all Command Prompt commands
by opening a Command Processor and typing
set /?
copy /?
cd /?

To open a Command Processor, you click Start / run / cmd {OK}.
Command.com is a legacy version of the Command Processor -
you should never use it. Use cmd.exe instead.
 
A

Academia

I was going to reply:
"But how do I know the names of the commands"
But tried "help" in the Command Processor and that gave all the names.

Thanks
 
A

Academia

I want to loop, as shown below, until the use
inputs "" for the name but I can't find a way to
set name to "".

I've tried :
set %name%=""




"set /p Target=Enter the path to the files:

:Again
set /p name=Enter a file name:
if "%name%"=="" goto Exit
if exist "%Target%\%name%" goto Action
echo Cannot locate "%Target%\%name%".
echo.
goto again

:Action
rem cd /d "%Target%"
Tidy.exe -miu "%Target%\%name%"
echo %name%
set name=""
echo %name%
goto again

:Exit
echo.
echo Press the Space Bar to close this window.
pause > nul
 
A

Academia

I thought I tried all combinations I could think of, with and without %.
Guess I missed that.

Thanks
 
P

Pegasus \(MVP\)

You're learning quickly! By the way, your code
set name=
echo %name%
won't work well because the command "echo" followed
by nothing or by spaces will generate the reply
"echo is off"
A better way is to write
echo Name=%name%$
The $ at the end serves to show if %name% is empty
or if it consists of one or several spaces. Spaces are
extremely important in batch files - try this:
@echo off
set Name1=Academia
set Name2 =University
echo Name1=%Name%
echo Name2a=%Name2%
echo Name2b=%Name2 %
 
A

Academia

Pegasus (MVP) said:
You're learning quickly! By the way, your code
set name=
echo %name%
won't work well because the command "echo" followed
by nothing or by spaces will generate the reply
"echo is off"
A better way is to write
echo Name=%name%$
The $ at the end serves to show if %name% is empty
or if it consists of one or several spaces. Spaces are
extremely important in batch files - try this:
@echo off
set Name1=Academia
set Name2 =University
echo Name1=%Name%
echo Name2a=%Name2%
echo Name2b=%Name2 %

Shouldn't I see" "echo is off" for Name1 or Name1b
@echo off
set Name1=Academia
set Name2 =University
echo Name1=%Name%
echo Name2a=%Name2%
echo Name2b=%Name2 %
set Name=
echo Name1b=%Name%

output

Name1=
Name2a=
Name2b=University
Name1b=

thanks
 
P

Pegasus \(MVP\)

Academia said:
Shouldn't I see" "echo is off" for Name1 or Name1b
@echo off
set Name1=Academia
set Name2 =University
echo Name1=%Name%
echo Name2a=%Name2%
echo Name2b=%Name2 %
set Name=
echo Name1b=%Name%

output

Name1=
Name2a=
Name2b=University
Name1b=

thanks

No, you should not because you're always outputting
the non-empty string "Name..=", regardless of the value
of the variable!
 
A

Academia

Pegasus (MVP) said:
No, you should not because you're always outputting
the non-empty string "Name..=", regardless of the value
of the variable!
\

Duh!
Unbelievable the mistakes one can make when in unfamiliar territories

Thanks for staying with me on this
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top