Skip to content
⌘ NSIS Forum Archive

get short path name

9 posts

freeman12#

get short path name

---Modified later---
Sorry i should just RTFM
plz delete this shameful post 🙁
--------------------

Hi,

I need to get the short(8.3) pathname given a long pathname...

here is an example :

From : c:\program files\my application
I would like : c:\progra~1\myappl~1

thx

rainwater#
It can be done easily with an extension using the GetShortPathName api call. If you want me to write up a basic extension dll I can, and I will post it here.
firepages#
well I wish you hadda posted the answer when you found it 🙂

I need to do the same thing... I need to write this liune to file...

FileWrite $9 "$INSTDIR\phpdev\php\php_win.exe $INSTDIR\phpdev\php\spiny\spiny.php $INSTDIR\phpdev\php\php_win.exe $\r$\n"


BUT using a short path - I did see the [SHORT] flag in the manual but have no clude how to use it in this (or any 🙂) situation...

any help would be much appreciated... the whole section is...

Function DoBatches
FileOpen $9 "$INSTDIR\startup.bat" w
FileWrite $9 "$INSTDIR\phpdev\php\php_win.exe $INSTDIR\phpdev\php\spiny\spiny.php $INSTDIR\phpdev\php\php_win.exe $\r$\n"
FileClose $9
FunctionEnd


and basically if the user selects c:\program files\
I want to write c:\progra~!\etc to file
nafigator#
Don't know what's the problem, but I can't make '/SHORT' work on win98 (nsis2a7, win98 se). It works fine on w2k and xp, but not with win98.
Checking with this
GetFullPathName /SHORT $1 $INSTDIR
DetailPrint $1
shows that $1 doesn't contain anything.
kichik#
Works for me. Are you sure $INSTDIR contains something? If it does, try using NSIS 2.0b0, if that doesn't help too attach the script.
nafigator#
Oops, I've been trying to get short path before actually creating InstDir 🙄
My fault.