Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

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
0
cpatte7372
Asked:
cpatte7372
  • 7
  • 3
  • 3
2 Solutions
 
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
 
cpatte7372Author Commented:
duncanb7

Going to try your suggestion now....

Cheers
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 7
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now