How To Create BATCH file from an EXE file

Hello Experts,

I've getting support from Solarwinds on how to Execute an external program from an executable file, see
https://thwack.solarwinds.com/message/243299?et=watches.email.thread#243299

I have been told to create a bat file from my exe, however I don't know how to create a batch file from an exe.

Can someone please show me.

Regards

Carlton
cpatte7372Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
you cannot transform a .EXE into a .BAT file.
.BAT file is basically just a text file containing command line scripts, while a .EXE is compiled machine code...

what you CAN do is have a batch file that calls the .EXE, eventually with arguments
what you CAN do is write an application (and compile it into .EXE) that does write .BAT files

what I understand for the linked page is the first one: have a .BAT file to call the .EXE file
possible with START (http://ss64.com/nt/start.html) but you can also call it directly.
the batch file can be created with a notepad, renamed from .TXT to .BAT
the file contents could be just be like this:
c:\program files\yourapp.exe
0
duncanb7Commented:
Open file called example.bat and put the following code into it that will call Microsoft office Excell  "excel.exe" program to open example excel workbook
and save it and open command prompt shell and run example.bat

Hope understand your question completely.if not, please pt it out.

Duncan
@echo off
:Start
"c:\program files (x86)\microsoft office\office12\excel.exe" c:\yourexmaple.xls

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cpatte7372Author Commented:
duncanb7

Going to try your suggestion now....

Cheers
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

cpatte7372Author Commented:
duncanb

I created the following bat file as you suggested but didn't work.

@echo off
:Start
"c:\program files (x86)\microsoft office\office12\excel.exe" C:\Users\Pattec01\Documents\theone.xls

When I run it I get the message:

'■@'

Not recognised..
0
duncanb7Commented:
just example, since you might not have excel.exe at that directory,

try your own  example such as notepad

@echo off
:Start
notepad.exe
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
this sounds like the file is saved "unicode", and should be saved "ascii" or vice-versa
when you do a save as, please check which encoding you put.

this said, I have already seen a couple of times that notepad may put a "strange" character in the beginning of the file, in which case you need to use another editor (ultraedit, notepad++, just to name the ones used here ...)
0
cpatte7372Author Commented:
Hi Guy,

The options I have are:

ANSI
Unicode
Unicode big endian
UTF-8

I don't have the ascii format.

Regards
0
cpatte7372Author Commented:
Chaps,

I managed to create a bat file with the following:

"C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe" /Script C:\temp\Script.vbs

I saved the file with Unicode. However, it won't execute in the program from the link I showed you above.

Guy, are you suggesting this still needs to be save in ascii? Even though I can get it to work from cmd prompt?

Cheers
0
duncanb7Commented:
could you try this first without  vps file ?

"C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe"
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sorry, ANSI , not ASCII...
what I suggest alternatively is to use another text file editor
0
cpatte7372Author Commented:
duncan,

Going to try now...

Guy, no worries mate.
0
cpatte7372Author Commented:
I can get the batch file to work.

However, I can't get it to work with the program in Solarwinds.....
0
cpatte7372Author Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Routers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.