Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch files

Status
Not open for further replies.

sdpsc

Technical User
Feb 10, 2001
76
When running a batch file, how do you get it out of 8-character maximum mode?
 
Assuming you aren't running under DOS or Win 3.x, just put quotes around the file name - especially if you have any embedded spaces in the path or file name.

What's giving you trouble?

Rick
 
Yeah, I'm on XP. Well, this is the DOS Window from my little test batch file that comes up after it is called from a FoxPro command:


The file name that the batch file uses is the actual name of the file, but it is over eight characters. I'm wondering how to do things with files that have more than eight characters in their filenames.
 
Code:
?GetShortPath(GETFILE())

****************************************
Function GetShortPath(tcFileName)
****************************************
	Local lnRes, lcPath

	Declare Integer GetShortPathNameA In Win32API As GetShortPathName String, String, Integer

	lcPath = Replicate(Chr(32), 165) + Chr(0)
	lnRes= GetShortPathName(tcFileName, @lcPath, 164)
	Clear Dlls GetShortPathName
	Return (Left(lcPath, lnRes))
ENDFUNC &&GetShortPath

boyd.gif

 
I'm wondering how to do things with files that have more than eight characters in their filenames.

Rick's solution works when you're typing the explicit name. Is you problem that you're passing the name in a parameter string? In that situation you have to insert your own quotes. Something like:

[tt]
lcPath="C:\Documents and Settings\g_r_franklin\Local Settings"
lcCmd = "SomeDOSProg '" + lcPath + "'"
[/tt]

Hope you can see the double and single quotes in the example.

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top