Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to run a command in bat file..??  (Read 7363 times)

0 Members and 1 Guest are viewing this topic.

BRSHRINET

  • Guest
How to run a command in bat file..??
« on: September 18, 2009, 08:58:43 AM »
Dear All,

I want run below command in .bat file but i have no idea how to make it Thur. Please help me on my question.

C:\Program Files\PrintFile>prfile32.exe /s:c:\test\*.txt


Thanking you

BR Shrinet

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: How to run a command in bat file..??
« Reply #1 on: September 18, 2009, 04:23:33 PM »
Welcome to the CH forums.

Quote
C:\Program Files\PrintFile>prfile32.exe /s:c:\test\*.txt

Why are you using the redirection symbol > should this not be a backslash?

One good deed is worth more than a year of good intentions.

Salmon Trout

  • Guest
Re: How to run a command in bat file..??
« Reply #2 on: September 19, 2009, 01:24:32 AM »

Why are you using the redirection symbol > should this not be a backslash?


It's not a redirection symbol; it's the last character ($g) of his console prompt.
« Last Edit: September 19, 2009, 01:52:06 AM by Salmon Trout »

Salmon Trout

  • Guest
Re: How to run a command in bat file..??
« Reply #3 on: September 19, 2009, 01:26:34 AM »
=
« Last Edit: September 19, 2009, 01:52:16 AM by Salmon Trout »

billrich

  • Guest
Re: How to run a command in bat file..??
« Reply #4 on: September 19, 2009, 01:47:17 AM »
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?
« Last Edit: September 19, 2009, 02:02:43 AM by billrich »

Salmon Trout

  • Guest
Re: How to run a command in bat file..??
« Reply #5 on: September 19, 2009, 02:10:32 AM »
Might work better with linux?

You cannot run .exe files in Linux. (except with WINE)

billrich

  • Guest
Re: How to run a command in bat file..??
« Reply #6 on: September 19, 2009, 11:33:08 AM »
You cannot run .exe files in Linux. (except with WINE)



It worked ok with Hieneken Beer.   ;D

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: How to run a command in bat file..??
« Reply #7 on: September 19, 2009, 04:59:54 PM »
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?


I want run below command in .bat file but i have no idea how to make it Thur. Please help me on my question.

C:\Program Files\PrintFile>prfile32.exe /s:c:\test\*.txt

One good deed is worth more than a year of good intentions.

Salmon Trout

  • Guest
Re: How to run a command in bat file..??
« Reply #8 on: September 19, 2009, 05:41:08 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)




Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: How to run a command in bat file..??
« Reply #9 on: September 19, 2009, 09:55:00 PM »
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.

One good deed is worth more than a year of good intentions.

Salmon Trout

  • Guest
Re: How to run a command in bat file..??
« Reply #10 on: September 20, 2009, 01:11:11 AM »
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




Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: How to run a command in bat file..??
« Reply #11 on: September 20, 2009, 02:06:21 AM »
Ahah!  Thank you again for the clarification...

One good deed is worth more than a year of good intentions.