Batch file has code of perl

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ngusaomanoi
Posts: 8
Joined: 13 Nov 2012 20:27

Batch file has code of perl

#1 Post by ngusaomanoi » 11 Mar 2013 21:00

I have a problem, my program only read batch file.
But i need some code of perl.How i can insert code perl in batch file.
Anybody give me some syntax to insert code perl.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file has code of perl

#2 Post by abc0502 » 11 Mar 2013 22:16

You can make the batch create the perl script then run that perl script.

This is how we make it create a VBscript and then run that vbscript:
@Echo OFF

IF NOT EXIST "%~DP0Voice.vbs" (
( FOR /F "tokens=1*" %%a IN ('findstr "^:Voice: " ^< "%~F0"') DO Echo.%%b )>"%~DP0Voice.vbs"
)
Cscript //nologo "%~DP0Voice.vbs" "%~1"
Goto :EOF
REM write your code here
:Voice: Dim message, sapi
:Voice: Set sapi=CreateObject("sapi.spvoice")
:Voice: sapi.Speak chr(34) & WScript.Arguments(0) & chr(34)

The red word "voice.vbs" is the vbscript file that will be created in the same location with this batch file
The blue word is a unique word that is written before each line of the vbscript code and followed with a single space.
The green word in the for command is used to identify the lines that will contain the vbscript code.
The light green line that starts with the "Cscript" is the command used to run vbscripts,

The for command search inside it's batch file for that unique word and take any code after it and put in the file "red word".


You will have to just change the "red words" to match your perl script file name, and add your perl script code in the batch after the "REM write your code here" then add in the beginning of each line of the code the same blue word, ( or change it with any but make sure to change the green word in the for command)
Then replace the light green command and add the one that is used to run perl scripts.

I hope that is clear enough :)

ngusaomanoi
Posts: 8
Joined: 13 Nov 2012 20:27

Re: Batch file has code of perl

#3 Post by ngusaomanoi » 11 Mar 2013 22:26

Thanks you so much abc0502 ^^~

Post Reply