Computing.Net > Forums > Disk Operating System > How to Get short file name in a batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to Get short file name in a batch file

Reply to Message Icon

Name: Hardeep Kandola
Date: February 23, 2000 at 11:43:59 Pacific
Comment:

I would like to get the short file name for a given file within a NT script (batch) file. I tried using "set SFN=%~ns1" (where parameter 1 is the long file name), but it does not seem to work.
I am using NT4.0 w/SP5.

Thanks,
Hardeep Kandola



Sponsored Link
Ads by Google

Response Number 1
Name: Ryan Cooley
Date: February 23, 2000 at 19:56:37 Pacific
Reply:

I'm not sure I understand. What do you need the file name of, what some variable has that will help recogonize the file, how exactly is your script posted supposed to work, and what do you need the short name output to? Email me.


0
Reply to Message Icon

Related Posts

See More


max length of dos command... remove part of date



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: How to Get short file name in a batch file

Using the Computer Name in a Batch Program www.computing.net/answers/dos/using-the-computer-name-in-a-batch-program/5560.html

Set variable to contents of a file. www.computing.net/answers/dos/set-variable-to-contents-of-a-file/13420.html

Max Line Length in a batch file www.computing.net/answers/dos/max-line-length-in-a-batch-file/9738.html