View Full Version : DOS Prompt ?


Andre' B
09-03-2008, 09:11 AM
Maybe a bit off topic but there should be some programmers around here.

OS is XP Pro x64
I have a small .bat program I am trying to run from the right click menu. It works fine but it hangs up in the dos screen, no prompt showing, I hit enter and it completes and the text shows up in the Windows clipboard.
Any ideas on how to get it to not wait for the enter key.

@echo off
set /p = %1 | clip
exit

Eurisko
09-03-2008, 05:20 PM
You might try redirecting the input from the console to a file, using the redirection operator '<'

The file would consist of a single character, ASCII 13.


A simple way to generate the file is to type in the following at the DOS prompt:

COPY CON: C:\EOL.TXT [ENTER] [ENTER] [CTRL-Z] [ENTER]

This creates the file "C:\EOL.TXT" ( a two-byte file, ASCII 13 & ASCII 10 )

Andre' B
09-04-2008, 08:24 AM
What I am trying to do is take whatever is in parameter %1 when the bat file is called and put it on the windows clipboard without changing it.

echo %1 | clip
Works but adds the linefeed/carriage return at the end.

set /p = %1 | clip
Does not change the text at all, unless the user types something other then just the Enter key, but it waits for the user input.

HuFlungDung
09-04-2008, 08:49 AM
Back when I fooled around with scripting in bobcad, we'd have to use some sort of string search to get individual characters from a source, minus any formatting characters. I have no idea how you'd do this with DOS commands though.

Eurisko
09-04-2008, 07:44 PM
Andre' B,
Create the EOL.TXT file (2 bytes) and place it in the same directory as your batch file.

Change the line in the batch file
set /p= %1 | clip

TO

set &lt;eol.txt /p=%1 | clip

This does exactly what you wanted, copies the parameter to the clipboard with no linefeed and returns to the DOS prompt without user input.

Andre' B
09-05-2008, 08:26 AM
Ah. Lightning strikes.
I must have miss read your first reply as redirecting the output to a file.

Not on the x64 system at the moment but your solution works on a XP Pro system, at least after I put the clip.exe program on it.

I wanted somthing that works like clippath but without the extra mouse click to select the type of path. And clippath does not seem to work on the x64 system.

Thanks, for the help.