Including EXE in the bat file not working

Convert your BATch files into EXEcutable format in one click.
Post Reply
kn1dmay1
Posts: 2
Joined: Tue Nov 03, 2009 3:48 pm

Including EXE in the bat file not working

Post by kn1dmay1 » Tue Nov 03, 2009 3:55 pm

I am trying to include the exe file that the batch file is running in the compiled exe. Here is the batch file and psshutdown is the exe.

psshutdown -r -f -t 1 -u username -p password \\computername

I tried it as %MYFILES%\psshutdown.exe and with both start and call in front of it and it seems to not see psshutdown.exe in %MYFILES%

If I leave the psshutdown.exe in the same place as when I added it in the Compiler it works but I want this to be self supporting so I do not have to send the psshutdown.exe with the batch file.

Any suggestions?

Thanks

kn1dmay1
Posts: 2
Joined: Tue Nov 03, 2009 3:48 pm

Fixed

Post by kn1dmay1 » Tue Nov 10, 2009 8:10 pm

I fixed it by placing

C:\DOCUME~1\%USERNAME%\"Local Settings"\"Application Data"\

in front of the exe file and it worked.

You guys should really document the %MYFILES% better and also make it where you can set it to whatever path you want.

support
Site Admin
Posts: 396
Joined: Fri Feb 13, 2004 1:05 pm

Post by support » Fri Nov 20, 2009 10:57 pm

Current version always use long file names, so you need to add quotes:

call "%MYFILES%\psshutdown.exe"

blasch
Posts: 3
Joined: Thu Sep 03, 2009 6:44 pm

Post by blasch » Sat Feb 20, 2010 8:16 pm

the long file names now affects %myfiles% calls in for loops...

still testing how to get around this...

bummer is I cannot update about 20 scripts until I figure this out.

Looks like you are pulling the APPDATA variable and mapping it to %Myfiles%

just a thought here, can you extract to a interative folder in appdata like qfb.000 qfb.001 etc... that way you can run multiple iterations of scripts that call %myfiles% and not step on the first scripts files.

support
Site Admin
Posts: 396
Joined: Fri Feb 13, 2004 1:05 pm

Post by support » Tue Feb 23, 2010 10:18 pm

Yes, we use APPDATA folder for embedded files.

paolone
Posts: 2
Joined: Fri Mar 11, 2011 11:34 am

Post by paolone » Fri Mar 11, 2011 3:57 pm

support wrote:Yes, we use APPDATA folder for embedded files.
I'm not sure it really works on all NT-derived Windows version. I've already sent to support email address my concerns and suggestions, since I have a similar issue with a batch file I am trying to compile.

1. What I am trying to do

write a single program which accepts a path and a name file, and then uses embedded mkisofs.exe program to create a ISO.

2. My issues

A) I can get the program running on my 64-bit Windows 7 machine only by placing the %MYFILES% path under commas.

This way it works:
"%MYFILES%"\mkisofs.exe -o %2 -D -R -J ... etcetera

but if i just place
%MYFILES%\mkisofs.exe -o %2 -D -R -J ...
it doesn't

B) if I move my program to a server using Windows 2003 Server (which is basically the server version of Windows XP), it just doesn't work.

I added this debug line to my batch file:
dir %MYFILES%\*.exe
it should list mkisofs.exe if everything is fine. And, in effect, on my computer it outputs
Directory di C:\Users\paolone\AppData\Local

11/03/2011 12:22 128.512 mkisofs.exe
1 File 128.512 byte
0 Directory 47.030.542.336 byte disponibili
which is OK. However, when running the same program on the Windows 2003 machine, the result is this:
The system cannot find the path specified.
I also tried ECHOing %MYFILES% to see what happens:
C:\tmp>echo %MYFILES%
%MYFILES%
Morale ==> the %MYFILES% variable isn't set up correctly. This will lead my whole project not to run.

In my email I suggest to Abyssmedia a simple solution: Instead of use Windows' paths like /local/application-data or /appdata/etc, just

mkdir %USERPROFILE%/QBFTMP0000
set %MYFILES% %USERPROFILE%/QBFTMP0000

execute the script and then

rmdir %USERPROFILE%/QBFTMP0000

this should work on any version of Windows, starting from NT and upwards.


But if I am wrong, please tell me where and how to fix this, and I will be really happier.[/quote]

paolone
Posts: 2
Joined: Fri Mar 11, 2011 11:34 am

Post by paolone » Fri Mar 11, 2011 4:29 pm

I've run the same project as-is on another Windows 2003 machine... and it works. :shock:

Astonishing.

I should look at permissions on the first machine, I think...

Post Reply