Solved

Scripting Question

Posted on 2006-06-15
3
258 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

861 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

23 Experts available now in Live!

Get 1:1 Help Now