Solved

Scripting Question

Posted on 2006-06-15
3
257 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
  • 2
3 Comments
 
LVL 95

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 95

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

I have never ceased to be amazed how many problems you can encounter on a fresh install of a Windows operating system.  This is certainly case in point& Unable to complete ANY MSI installation.  This means Windows Updates are failing and I can't …
I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now