?
Solved

Scripting Question

Posted on 2006-06-15
3
Medium Priority
?
264 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 800 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 800 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 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