I have a bat file that I want to convert into an exe so I can add a icon and a name. But I also need it to accept parameters like my bat file.
Here's the bat file receive parameters like this:%*
The bat file works fine on it own.
@echo off
title Parsing...
set v=%temp%\cmd.vbs
set d=%temp%\decode.wsc
(echo ^<?xml version="1.0"?^>^<component^>^<?component error="true" debug="true"?^>
echo ^<registration description="Url Decode Helper" progid="JSEngine.Url" version="1.0" classid="{80246bcc-45d4-4e92-95dc-4fd9a93d8529}" /^>
echo ^<public^>
echo ^<method name="decode"^>^<PARAMETER name="s"/^>^</method^>
echo ^</public^>
echo ^<script language="JScript"^>
echo ^<!^[CDATA^[
echo var description=new UrlEncodeDecodeHelper;
echo function UrlEncodeDecodeHelper^(^)^{this.decode=decode;^}
echo function decode^(s^)^{return decodeURIComponent^(s.replace^(/\+/g," "^)^);^}
echo ^]^]^>
echo ^</script^>
echo ^</component^>)>%d%
(echo Set JSEngine=GetObject^("Script:C:\Users\vanes\AppData\Local\Temp\decode.wsc"^)
echo Set obj=WScript.CreateObject^("WScript.Shell"^)
echo stre=JSEngine.decode^(Wscript.Arguments^(0^)^)
echo str=Mid^(stre,5^)
echo If Len^(stre^)^>5 Then
echo 'Remove the ^(^'^) from run and move it to para for it to run without confirmation
echo para^(^)
echo 'run^(^)
echo Else
echo obj.Run^("cmd.exe"^)
echo End If
echo.
echo Function para^(^)
echo MsgBox str,vbOKOnly+vbInformation+4096,"Code passed by program:"
echo user=MsgBox^("Do you allow it to pass to the Command prompt and run?",vbQuestion+4096+vbYesNo+vbDefaultButton2,str^)
echo If user=vbYes Then
echo run^(^)
echo Else
echo End If
echo End Function
echo Function run^(^)
echo obj.Run^("cmd.exe /k " ^& str^)
echo End Function)>%v%
rem creates the wsc and vbs files needed.
wscript %v% %*
del %v% %d%
I've tried all sorts of converters but they don't allow me to pass parameters. Is there any other converter or way to do it manually that will allow me to pass parameters into the exe file created?
I don't need it to have a icon and name right away I can add them through Resource hacker.
I'm trying to make a URL parser that will parser a URL like
cmd:shutdown /s
so the commandshutdown /s
will be sent into the command prompt and run. But only if the user allows it to be passed to the cmd! Here the idea_ https://youtu.be/46pBeyHKQuQ