Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Batch File Problem


  • Please log in to reply

#1
magusbuckley

magusbuckley

    Member

  • Member
  • PipPipPip
  • 626 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!

  • Community Leader
  • 26,047 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
  • 626 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
  • 354 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