Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

How to execute .exe INDIRECTLY trough another .exe, .bat etc...

- - - - -

  • This topic is locked This topic is locked
31 replies to this topic

#1
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag
Hello,

I'd like to do the following... For example, I have a file "data.txt" and by double clicking on it I'd like to send the request to another .exe, .bat, or whatever and call/redirect to the "real" .exe from there.

In other words I'd like to execute the C:\Windows\system32\notepad.exe INDIRECTLY and of corse I'd like for ALL .txt files to open this way.

An example... I'm telling Josh to tell Joe I'm going to be late! :)

Thank you!

Edited by cplusdummy, 10 February 2013 - 06:40 AM.



How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,385 posts
  • OS:none specified
  • Country: Country Flag
May I ask you WHY?

In any case, change the file association to the .txt file to the *whatever* program you want to call instead of notepad.exe and make sure that this *whatever* actually calls notepad.exe.
See:
http://wstudios.home...iate/index.html

jaclaz

#3
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag
Hi jaclaz,

I did not describe why because the answers would deteriorate from the question and people would post suggestions trying to solve the issue from different angles. Once solved I promise I'll describe the source of the problem.

As for your answer, yes I know how to handle file associates in widows. It's just a matter of Right Click --> Open With --> Choose Program --> Tap on "Always use the selected program..." --> Select Program or browse to it...

The problem is I don't have "Josh" (see my previous post).

#4
5eraph

5eraph

    Update Packrat

  • MSFN Sponsor
  • 1,152 posts
  • OS:XP Pro x64
  • Country: Country Flag

Donator

Josh is his own person, unless he is a prisoner and you are a guard or the warden. It stands to reason that if Josh isn't with you, and you can't contact him, then you can't tell him anything.

Likewise, if we don't have an adequate grasp of the actual problem, there's no way we can tell you much of consequence.

Edited by 5eraph, 10 February 2013 - 09:44 AM.


#5
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag

Josh is his own person, unless he is a prisoner and you are a guard or the warden. It stands to reason that if Josh isn't with you, and you can't contact him, then you can't tell him anything.

Likewise, if we don't have an adequate grasp of the actual problem, there's no way we can tell you much of consequence.


True, that's why I'm asking you or anybody here to bring him to me :)

No, seriously I need to setup .txt files to trigger the whatever.exe (which I don't have) and redirect the request to notepad.exe.

#6
5eraph

5eraph

    Update Packrat

  • MSFN Sponsor
  • 1,152 posts
  • OS:XP Pro x64
  • Country: Country Flag

Donator

Well, you could try setting it through a registry entry as Kai Liu has done for Notepad2.

HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\whatever.exe","Debugger",,"%10%\Notepad.exe"

Edited by 5eraph, 10 February 2013 - 09:58 AM.


#7
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag

Well, you could try setting it through a registry entry as Kai Liu has done for Notepad2.


You don't seem to understand my issue. I don't try to replace anything. I just want to run a .exe file indirectly. I DON'T HAVE the whatever.exe file! What I need to know is how to code a whatever.exe (or whatever.bat etc...) file that when it is called it calls another .exe file.

Edited by cplusdummy, 10 February 2013 - 11:22 AM.


#8
5eraph

5eraph

    Update Packrat

  • MSFN Sponsor
  • 1,152 posts
  • OS:XP Pro x64
  • Country: Country Flag

Donator

As long as TXT files are already associated with whatever.exe, and you have that registry entry, then you shouldn't need whatever.exe. In this case Windows is Josh, and Joe is Notepad. ;)

Edited by 5eraph, 10 February 2013 - 12:08 PM.


#9
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,278 posts
  • OS:none specified
  • Country: Country Flag
I'm not going to swear by this, but I THINK that the OP want to somehow cause a TXT file to be "transmitted" to JOE via JOSH and "opened", very "similar" (stipulating with quotation marks) to the Windows Messaging System.

I'm telling Josh to tell Joe I'm going to be late

Question poser - WHY would you want an Intermediary for such a task? Is there a reason you can't "talk" to JOE directly? I see no purpose to "pushing" an EXE execution OP->JOSH->JOE unless the "purpose" is to run "whatever.exe" on JOE without JOE knowing it was the OP.

Sorry, but this is a REALLY strange "method" request and (no offense) smells a bit "fishy". Could you elaborate the purpose of this? Your first example doesn't square with

I need to setup .txt files to trigger the whatever.exe (which I don't have) and redirect the request to notepad.exe

YOU have the TXT file and want IT to "trigger" JOSH "whatever.exe" to "trigger" JOE "NOTEPAD.EXE" to display YOUR "TXT" on JOE??? Very odd! Just IM JOE, bearing in mind Windows Messaging is a favorite Service used by Spammers.
http://en.wikipedia....ssenger_service
which references
http://en.wikipedia....ssenger_service

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#10
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag

YOU have the TXT file and want IT to "trigger" JOSH "whatever.exe" to "trigger" JOE "NOTEPAD.EXE" to display YOUR "TXT" on JOE???


E X A C T L Y!!! At last....

There is nothing fishy to it because I know this can be done simple. As I promised I'll tell you what is it for once solved. I just want to save myself from answers such as "why don't you try this and that instead...".

For example, I'm a PHP developer. I can call test.php indirectly by including it to info.php and calling http://www.example.com/info.php. I don't know why is this so hard to understand.

It does not have to be strictly a .exe file. I want to know how to call notepad.exe when double clicking on a .txt trough a second .exe, .bat or whatever...

#11
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,385 posts
  • OS:none specified
  • Country: Country Flag
Do you mean something like (extremely simplified .cmd batch file):

@ECHO OFF
START "" /WAIT NOTEPAD.EXE %1


http://ss64.com/nt/start.html

jaclaz

Edited by jaclaz, 10 February 2013 - 03:12 PM.


#12
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,278 posts
  • OS:none specified
  • Country: Country Flag
Dude, here's your problem. Websites (and building a website) have Local or Remote (e.g. WWW) methods of "linking". I can see no way to "link into" ANOTHER person's PC the ANOTHER person's PC except via Remote (even if it's a Locally Connected PC).

You're looking at this from the perspective of the Web (as you say PHP coder). What you're asking for would be along the lines of a "hacker's delight". IOW, I defy you to do that by ANY means to my PC via My Brother's PC (who lives in the next state) unless I personally Initiated DIRECTLY from HIS PC after HE initiated from YOURS, all Remotely, understand (see last sentence)?

Bottom line - good luck to you as I see it as an "impossible task" UNLESS you write PROGRAM that can COMMUNICATE between the three (You, Josh, and Joe) AND the Firewall/Antivirus would ALLOW it (depending on the software). Routers act in the same way - BLOCKING certain In-Ports unless specifically opened. You're talking DIRECT TCP Communications and RUNNING a Program on a Remote. Consider this - HOW do you think "installing" an ActiveX works? The concept you want to conceptually achieve is the same. NOW also consider an IM program that TWO (or more) persons can Communicate with. THAT is essentially what you're asking for except via "script kiddie" methods, correct?

You LITERALLY need Open-ended "Read/Write" Access via TCP/IP between all three, TRANSMITTING to the Intermediary which would TRANSMIT to the END and RUN a Program to READ it.

Again, good luck!

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#13
5eraph

5eraph

    Update Packrat

  • MSFN Sponsor
  • 1,152 posts
  • OS:XP Pro x64
  • Country: Country Flag

Donator

For some reason, jaclaz has not yet responded as I would have expected. So I will.

#14
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,385 posts
  • OS:none specified
  • Country: Country Flag

For some reason, jaclaz has not yet responded as I would have expected. So I will.

Well, you'll have to pay a fee for re-using my aswers :whistle: and a fine for using them without my prior authorization. :ph34r:

Just like you cannot make up words ;):
Spoiler


jaclaz

#15
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,278 posts
  • OS:none specified
  • Country: Country Flag
@cplusdummy - School Project? :whistle: (google is my friend... sometimes)

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#16
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag

Do you mean something like (extremely simplified .cmd batch file):

@ECHO OFF
START "" /WAIT NOTEPAD.EXE %1


http://ss64.com/nt/start.html

jaclaz


jaclaz you're the MAN! Simple answer to a simple question!

As promised, here's why I needed this...

squidooDOTcom/open-illustrator-files-in-maximized-window

I don't want to include the the full link as it would be considered as spam and retyping the answer would be annoying.

Before you might think there must be a simpler solution for this... well, there is not! Googled it and people are reporting this problem to no avail.

Thank you everybody!

Edited by cplusdummy, 12 February 2013 - 02:58 PM.


#17
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,385 posts
  • OS:none specified
  • Country: Country Flag
Well, your explanation is completely unlike an explanation :w00t: , post the full link if you want to explain something.

BTW that small batch will also open a command prompt window if double clicked or added to a context menu.

You might want to use a tool like nircmd:
http://www.nirsoft.n...ils/nircmd.html

instead.
Look for it's commands exec, exec2 and execmd
http://www.nirsoft.n...cmd2.html#using

jaclaz

#18
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag

Well, your explanation is completely unlike an explanation :w00t: , post the full link if you want to explain something.


Okay,

http://www.squidoo.c...aximized-window

I'll edit the squidoo post tomorrow and link back to this discussion for compensation...

Yes, it opens the command prompt window but once the file opens it disappears.

Thanks again!

#19
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,385 posts
  • OS:none specified
  • Country: Country Flag

Yes, it opens the command prompt window but once the file opens it disappears.

With the /WAIT parameter? :unsure:

Even if it does, let me rephrase previous post as "a black box will either open (and remain open until you terminate the "target" program) or flash briefly on the screen, to avoid that use nircmd, INSTEAD" :whistle:

jaclaz

#20
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
I dont know if this is what he wants, but this hides the cmd promt window, just
drag and drop any file notepad can open,
Dim C34 :C34=Chr(34)
If WScript.Arguments.Count = 1 Then
 CreateObject("Wscript.Shell").Run("%Comspec% /C @Echo Off && Start " & _
 C34 & "" & C34 &"/Wait Notepad.exe " &WScript.Arguments(0)),0,True
End If 

Notepad.vbs in Cmd promt, open the text file

CD C:\Users\Gunsmokingman\Desktop
echo %CD%
C:\Users\Gunsmokingman\Desktop
OpenNotepad.vbs TelusUpload.txt




GunSmokingMan



#21
cplusdummy

cplusdummy

    Newbie

  • Member
  • 10 posts
  • OS:XP Pro x86
  • Country: Country Flag


Yes, it opens the command prompt window but once the file opens it disappears.

With the /WAIT parameter? :unsure:

Even if it does, let me rephrase previous post as "a black box will either open (and remain open until you terminate the "target" program) or flash briefly on the screen, to avoid that use nircmd, INSTEAD" :whistle:

jaclaz

I'm really not familiar with windows scripting/programming but I have PHP knowledge so I added the /MAX parameter after /WAIT using some logic.

Now when I double click on .ai or .eps file the black box opens and remains open until the program completely processes/opens the file. After few seconds, once the file is opened and editable the box DISAPPEARS AUTOMATICALLY.

I don't know if this is how it's supposed to function but it's serving the purpose perfectly! :thumbup

#22
DataCracker7899

DataCracker7899

    Newbie

  • Member
  • 15 posts
  • OS:Windows 7 x86
  • Country: Country Flag
make batch file start C:\Windows\System32\Notepad.exe

then save as .bat and all files.
when you run it it'll open notepad
I am a professional programmer and plz email me and i will help you. my email is: andregoodarzi@hotmail.com i'm master in many programming languages and i can make websites too.


//AndreG7899
//DataCracker7899

#23
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,278 posts
  • OS:none specified
  • Country: Country Flag

make batch file start C:\Windows\System32\Notepad.exe

then save as .bat and all files.
when you run it it'll open notepad

You mean like was proposed by jaclaz in post#11??? :whistle:
You might want to read a thread to get the full gist first... ;)
( yeah, I've done the "repeat someone else" before... :blushing: )

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#24
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

The only ways you can use a script is to associate a particular process with a specific file extension. (They are talking about double clicking on a .txt file)

If you want to have a script executed in this manner you'd need to re-associate .txt files on the end user's system with the scripting engine pertinent to the type of script you're invoking.


Your alternative is to create a script 'packaged/compiled' to an executable, name it notepad.exe in the location of your proper notepad.exe and use it to call that original notepad exe in its new location.

The problem with both those approaches is that that they are to be carried out on your end users PCs.

#25
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,385 posts
  • OS:none specified
  • Country: Country Flag
Yzöwl , the OP already tested the proposed solution, modified it a little according to his needs and is using it successfully (for his needs):

Now when I double click on .ai or .eps file the black box opens and remains open until the program completely processes/opens the file. After few seconds, once the file is opened and editable the box DISAPPEARS AUTOMATICALLY.

I don't know if this is how it's supposed to function but it's serving the purpose perfectly! :thumbup

This thread (actualy the issue that originated it) was "closed" until DataCracker7899 revived it by re-posting (incompletely) the SAME info already posted in it.

jaclaz




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN