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
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.
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.
Summary: I forgot to mention, to make this info useable in a batch file you might want to dump it into a txt file. Then use your favorite language to parse the file. I would then set all of the variables into...
Summary: Hello, I was just trying to set a variable to the contents of a file in a batch file. For example... I did a CD>Current_dir.txt to find out where I am.. and then want to set a CRNT_DIR=current_dir.tx...
Summary: As basic as this should be, I don't know the maximum line length permissible in a batch file. On a command line I know its 127 characters, and I know it's longer in a batch file. Can you help? ...