• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Scripting Question

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
kristinaw
Asked:
kristinaw
  • 2
2 Solutions
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
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
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Great site for batch scripting:
www.robvanderwoude.com
0
 
canaliCommented:
  %~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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now