Solved

Scripting Question

Posted on 2006-06-15
3
262 Views
Last Modified: 2010-04-18
I am trying to figure out what scripting language syntax such as this:
Set blah="%~d0"
would be used in, and what exactly this line of code might be attempting to accomplish?

Any help much appreciated.

Kris.
0
Comment
Question by:kristinaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 200 total points
ID: 16914677
Typically, you can type the initial command followed by /?, for example:

SET /?

HOWEVEr, this particular command is not covered there.  It is in FOR /?
 %~I         - expands %I removing any surrounding quotes (")
 %~fI        - expands %I to a fully qualified path name
 %~dI        - expands %I to a drive letter only
 %~pI        - expands %I to a path only
 %~nI        - expands %I to a file name only
 %~xI        - expands %I to a file extension only
 %~sI        - expanded path contains short names only
 %~aI        - expands %I to file attributes of file
 %~tI        - expands %I to date/time of file
 %~zI        - expands %I to size of file
 %~$PATH:I   - searches the directories listed in the PATH
                environment variable and expands %I to the
                fully qualified name of the first one found.
                If the environment variable name is not
                defined or the file is not found by the
                search, then this modifier expands to the
                empty string
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16914681
Great site for batch scripting:
www.robvanderwoude.com
0
 
LVL 14

Assisted Solution

by:canali
canali earned 200 total points
ID: 16916491
  %~dI        - expands %I to a drive letter only
this line is a modifier applied to the variable %0 (contain the full command line of the batch)
example if u run the follow batch "k:\sample\go go\ok.cmd" p1 p2
set blah=%~d0
::blah now is k:
Set blah="%~d0"
::blah now is "k:"
set blah=%blah:~1,-1%
::blah now is k:

if u run "\\server\share\go go\ok.cmd" p1 p2
set blah=%~d0
::blah now is \\
Set blah="%~d0"
::blah now is "\\"

set blah=%blah:~1,-1%
::blah now is \\

Gas
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question