Results 1 to 3 of 3

Thread: Batch File Variable

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Batch File Variable

    Hi All,

    going back a decade or two, I am writing a Batch File to filter all the user profiles on the system.

    D:\TSprofiles1\UsersNames is the location of all the files. normally I would use a command similar to

    Code:
    dp1.bat
    CD D:\
    CD D:\TSprofiles1
    DEL D:\TSprofiles1\%1\Cookies\*.*
    DEL D:\TSprofiles1\%1\Temporary Internet Files\*.*
    
    Call DP1.bat UserName
    Call DP1.bat User2Name
    Call DP1.bat User3Name
    However I am not sure if this will work on a windows server 2000. Is the %1 the variable to access all folders and subfolders within?
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Batch File Variable

    dp1.bat foo

    If this is dp1.bat
    CD D:\
    CD D:\TSprofiles1
    DEL D:\TSprofiles1\%1\Cookies\*.*
    DEL D:\TSprofiles1\%1\Temporary Internet Files\*.*

    then

    CD D:\
    CD D:\TSprofiles1
    DEL D:\TSprofiles1\foo\Cookies\*.*
    DEL D:\TSprofiles1\foo\Temporary Internet Files\*.*
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Batch File Variable

    so how does foo recognise that I want to act upon each of the sub folders in the profiles directory?
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width