EmuNewz Network
JPCSP start batch won't run like administrator - Printable Version

+- EmuNewz Network (https://www.emunewz.net/forum)
+-- Forum: PSP Emulation (https://www.emunewz.net/forum/forumdisplay.php?fid=191)
+--- Forum: JPCSP Official Forum (https://www.emunewz.net/forum/forumdisplay.php?fid=51)
+---- Forum: svn trunk discussion (https://www.emunewz.net/forum/forumdisplay.php?fid=56)
+---- Thread: JPCSP start batch won't run like administrator (/showthread.php?tid=87454)



JPCSP start batch won't run like administrator - montcer9012 - 10-14-2012

JPCSP script x64/x86 does not locate JPCSP.JAR if i try to run it like administrator: Right click -> Run as administrator. JPCSP launcher does not have this issue; it can start Java with administrator privileges.

I guess it happen because the CMD is starting from C:\Windows\System32\CMD.exe instead the JPCSP extract folder; however, when it is execute normally the start patch is the same: "C:\Windows\System32\CMD.exe".
x64
   
x86
   


RE: JPCSP start batch won't run like administrator - hyakki - 10-14-2012

could you try adding this to the bat file and see if it fixes it
add under @echo off
for /f %%I IN ("%0") do cd %%~dpI

(what this should do is extract the path of the running bat file then change the directory back to the working jpcsp directory.)


RE: JPCSP start batch won't run like administrator - montcer9012 - 10-14-2012

Yeah it works, thanks. I was trying first to add %~dp0 at the beginning of lib\ and bin\ but it keep looking for the rest of the files on System32. With the FOR command it look for all the files on main folder.

gid, maybe you want to add that command on the next builds.

Also, on the :END ticket should be added a PAUSE command because some times it gave some error about some allegrex thing; with the PAUSE everybody should be able to save the error about this.


RE: JPCSP start batch won't run like administrator - gid15 - 10-14-2012

(10-14-2012, 05:29 AM)hyakki Wrote: could you try adding this to the bat file and see if it fixes it
add under @echo off
for /f %%I IN ("%0") do cd %%~dpI

(what this should do is extract the path of the running bat file then change the directory back to the working jpcsp directory.)
It doesn't work for me when the path is containing a directory with a space in its name, e.g. "C:\Users\XXXX YYYY\Desktop\jpcsp-windows-x86"


RE: JPCSP start batch won't run like administrator - hyakki - 10-14-2012

maybe try adding quotes around cd "%%~dpI"


RE: JPCSP start batch won't run like administrator - montcer9012 - 10-14-2012

(10-14-2012, 05:59 AM)gid15 Wrote: It doesn't work for me when the path is containing a directory with a space in its name, e.g. "C:\Users\XXXX YYYY\Desktop\jpcsp-windows-x86"
You try quoting the patch? ""

EDIT: No, don't work even quoted.


RE: JPCSP start batch won't run like administrator - hyakki - 10-14-2012

hmm I actually cant re-produce the administrator issue on my pc..(probly because I use an administrator account all the time)
can you try
under echo off
cd /D "%~dp0"

--
I just did a simple test like
cd /D C:\
cd
cd /D "%~dp0"
cd

and it seemed to change back even with spaces (I added /D so it changes drives if needed)

Edit:
Added quotes, always better to have them Smile



RE: JPCSP start batch won't run like administrator - montcer9012 - 10-14-2012

Yeah, that one works even with spaces on the patch.

Also, some quotes on "%~dp0" aren't necessary? I tried on patch with spaces and without and works with no quotes.


RE: JPCSP start batch won't run like administrator - gid15 - 10-14-2012

Now added in r2772 Smile


RE: JPCSP start batch won't run like administrator - montcer9012 - 10-14-2012

Thanks!