Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Batch File Problem


  • Please log in to reply

#1
magusbuckley

magusbuckley

    Member

  • Member
  • PipPipPip
  • 625 posts
Hello:

I'm trying to get a batch file to delete files from a certain directory. The path to the folder includes folder names that are two words long. I have truncated all file names that are longer than 8 characters with the ~1. I'm unable to get past the spaces though. Here is an example:

The actual path is:
C:\Documents and Settings\jobapplicant\Local Settings\Temporary Internet Files\*.*

The path in the batch file looks like this:
c:\Docume~1\jobapp~1\Local ~1\Tempor~1\*.*

The problem is with the folder Local Settings. In the path I've created in the second example, notice the space found between "l" and "~". How can I get DOS to compensate for this space?

Any and all information will be greatly appreciated.

Thanks,

Magus
  • 0

Advertisements


#2
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
put the entire path in quotes with the spaces
"c:\documents and settings\user\desktop" will compensate for the spaces
  • 0

#3
magusbuckley

magusbuckley

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 625 posts
dsenette:

That did the trick. I'm using this fix for my big project (the one about granting access to only three web pages).

I appreciate your help.

:whistling:

Thanks,

Magus
  • 0

#4
diggeryo

diggeryo

    Member

  • Member
  • PipPipPip
  • 343 posts
Dsenette's solution is the easiest but to correct using the method you were originally trying, this is what you would have to do:

Change this:
c:\Docume~1\jobapp~1\Local ~1\Tempor~1\*.*

to this:

c:\Docume~1\jobapp~1\LocalS~1\Tempor~1\*.*


The reason for this is that you take the first 6 VALID characters. So even though the 6th character in "Local Settings" is a space, the 6th valid character is the letter "S".

Edited by diggeryo, 11 December 2006 - 03:53 PM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP