Saved Bookmarks
| 1. |
Solve : How to run a command in bat file..??? |
|
Answer» Dear All, C:\Program Files\PrintFile>prfile32.exe /s:c:\test\*.txt Why are you using the redirection symbol > should this not be a backslash? Quote from: Dusty on September 18, 2009, 04:23:33 PM
It's not a redirection symbol; it's the last character ($g) of his console prompt. =Code: [Select]@echo off cd C:\Program Files\PrintFile\ prfile32.exe c:\test\*.txt Rem Or REM cd \ REM C:\Program Files\PrintFile\prfile32.exe c:\test\myfile.txt Rem Test ONE file first and then use wildcard * print32.exe is a third party program not on my machine and I cannot test the above. I do not want to download. Might work better with linux?Quote from: billrich on September 19, 2009, 01:47:17 AM Might work better with linux? You cannot run .exe files in Linux. (except with WINE) Quote from: Salmon Trout on September 19, 2009, 02:10:32 AM You cannot run .exe files in Linux. (except with WINE) It worked ok with Hieneken Beer. Quote from: Salmon Trout on September 19, 2009, 01:24:32 AM It's not a redirection symbol; it's the last character ($g) of his console prompt. Did I misunderstand the OP's request or is it just a language interpretation thing? Quote from: BRSHRINET on September 18, 2009, 08:58:43 AM Quote from: Dusty on September 19, 2009, 04:59:54 PM Did I misunderstand the OP's request or is it just a language interpretation thing? It seemed clear to me that the OP had either copied and pasted or else typed afresh what they could see in the command window: C:\Program Files\PrintFile>prfile32.exe /s:c:\test\*.txt The prompt shows that the CURRENT directory is C:\Program Files\PrintFile. Having logged into that directory, the OP then issued the command prfile32.exe /s:c:\test\*.txt The default prompt format that which is obtained by issuing the command PROMPT $P$G, where $P means the current drive letter, path and folder, and $G means the > character*. That is where your "redirection character" comes from. Code: [Select]C:\>prompt /? Changes the cmd.exe command prompt. PROMPT [text] text Specifies a new command prompt. Prompt can be made up of normal characters and the following special codes: $A & (Ampersand) $B | (pipe) $C ( (Left parenthesis) $D Current date $E Escape code (ASCII code 27) $F ) (Right parenthesis) $G > (greater-than sign) $H Backspace (erases previous character) $L < (less-than sign) $N Current drive $P Current drive and path $Q = (equal sign) $S (space) $T Current time $V Windows XP version number $_ Carriage return and linefeed $$ $ (dollar sign) Quote from: Salmon Trout It seemed clear to me that the OP had either copied and pasted or else typed afresh what they could see in the command window: Ahhh, darnit, why didn't I think of that? Seems Billrich didn't either as he also suggests replacing the > char with the \ char. Thank you for your clarification. Quote from: Dusty on September 19, 2009, 09:55:00 PM Ahhh, darnit, why didn't I think of that? Seems Billrich didn't either as he also suggests replacing the > char with the \ char. But Billrich was on the right TRACK. Consider: You have a command window in a folder, D:\Path\folder. Here is the prompt that you see: (1) Code: [Select]D:\Path\folder> You want to run a program called Program.exe (which is in that folder) so what do you type at the prompt? Why, its name (and extension probably). So, just before you hit Enter the command window looks like this: (2) Code: [Select]D:\Path\folder>Program.exe You want to supply it with with a PARAMETER string: /a:b:\cdef\*.ghi so you add that after the program name: (3) Code: [Select]D:\Path\folder>Program.exe /a:b:\cdef\*.ghi Now: how do you put all that in a one line batch file so that you can just e.g. plonk it on your desktop and thereafter double CLICK its icon when you want to perform the operation? Why, you need the path to the program, its name and extension, and the parameter string: (4) Code: [Select]D:\Path\folder\Program.exe /a:b:\cdef\*.ghi The only difference visually between (3) and (4) is that the final > character from the prompt has been replaced by the final \ character of the program folder path. What Billrich needed to add were the double quotes necessary because "Program Files" contains a space. Code: [Select]"C:\Program Files\PrintFile\prfile32.exe" /s:c:\test\*.txt Ahah! Thank you again for the clarification... |
|