Long path name

Started by Jeff, March 27, 2014, 09:33:37 AM

Previous topic - Next topic

Jeff

I am trying to call an executable from winbatch that pipe out the results to a csv file. I have found on Windows 2003, when I call a long path I get a "c:\documents" is not recognized as an internal or external program or batch file. I am sure windows is truncating this at the first space. Can anyone offer some advice on how to handle this? Below is a small script that may give you insight on what I am trying to do. Thanks.

BatDirectory = DirScript()
BatFile= "appinfo.Bat"

BatFile=strcat(BatDirectory,batFile)

driveltr = StrSub (BatFile, 1, 2)

handle = FileOpen(BatFile, "write")
FileWrite(handle,"REM - GENERATED BAT FILE")
FileWrite(handle,driveltr)
FileWrite(handle, strCat('cmd /c ', DirScript(),'MyAppInfoToCSV.exe'>',DirScript(),'AppInfo.csv'))
FileClose(handle)

RunWait('cmd','/K %BatFile%')
Jeff

Deana

If you are passing a long file name that contains spaces on a command line you must surround the file path with double quotes. For example (see lines marked by ;!!!!):

Code (winbatch) Select
BatDirectory = DirScript()
BatFile= "appinfo.Bat"

BatFile=StrCat(BatDirectory,batFile)

driveltr = StrSub (BatFile, 1, 2)

handle = FileOpen(BatFile, "write")
FileWrite(handle,"REM - GENERATED BAT FILE")
FileWrite(handle,driveltr)
FileWrite(handle, strCat('cmd /c "', DirScript(),'MyAppInfoToCSV.exe">"',DirScript(),'AppInfo.csv"')) ;!!!!
FileClose(handle)

RunWait('cmd','/K "%BatFile%"') ;!!!!
Deana F.
Technical Support
Wilson WindowWare Inc.

adamenko

Did you try out the Long Path Tool? Its sure to sort out your problem.