1.    28 Feb 2017 #1
    Join Date : Oct 2015
    Posts : 57
    windows 8.1

    do we still have %~ in batch files in windows 10


    Greetings
    I still write batch files like I always did since dos.
    In windows XP all kinds of %~ variables were added to the vocabulary.
    Do we still have those or were they replaced by other in windows 10?
    where do I find a list of batch file commands still used in windows 10?
    thank you
      My ComputerSystem Spec
  2.    28 Feb 2017 #2
    Join Date : Feb 2017
    Home
    Posts : 479
    Windows 10 Home x64, V1709 (16299.64)
      My ComputersSystem Spec
  3.    28 Feb 2017 #3
    Join Date : Mar 2015
    Sydney, NSW
    Posts : 93
    Windows 10

    Hi,

    Quote Originally Posted by zivshosh View Post
    In windows XP all kinds of %~ variables were added to the vocabulary.
    Do we still have those or were they replaced by other in windows 10?
    That syntax resembles either argument expansion or expansion of dynamic variables from the For loop. The way youíve phrased your question though, ďwere added to the vocabularyĒ, makes it sound like itís a variable in itself but itís more of a syntactic feature primarily used to strip quotes from dynamic variables. ď%~Ē has an extended meaning in a for loop however (see Breeís answer). The command processor hasnít been updated in years, but I canít verify for you if ď%~Ē had existed back then.

    Quote Originally Posted by zivshosh View Post
    where do I find a list of batch file commands still used in windows 10?
    Typically in a shell language you donít get the luxury of knowing what commands are available for use. You just have to know that a particular command exists to be able to use it. There are a couple of command lists online though. SS64, which Iíve linked to in this post twice already, has a really good one. Their documentation is actively kept up to date as well.
    Last edited by Pyprohly; 28 Feb 2017 at 08:51. Reason: Fixed awkward wording
      My ComputerSystem Spec
  4.    28 Feb 2017 #4
    Join Date : Feb 2017
    Home
    Posts : 479
    Windows 10 Home x64, V1709 (16299.64)

    This isn't my thread, but thanks for that link anyway.
      My ComputersSystem Spec
  5.    28 Feb 2017 #5
    Join Date : Aug 2016
    S/E England
    Posts : 4,488
    10 Home x64 (1709) (10 Pro on 2nd pc)

    Quote Originally Posted by Pyprohly View Post
    ...the command processor hasnít been touched much in years although I canít verify if ď%~Ē syntax existed back then.
    %~ is interesting, and proves there's always more to learn (well, it's new to me) and, yes, they work in Win10.

    Windows NT 4 introduced a set of new features for command line parameters...
    ...
    %~fn will return the fully qualified path of %n if %n is a valid file name or directory
    Batch files - Command line parameters

    The variables %0, %1, %2, %3, .... %9 have existed since DOS. They are the arguments used to call the batch file, %0 being the name of the batch file itself. For example, save the following as Tell_Me.bat then run it with a few parameters.

    Code:
    @echo off
    echo You called %~f0 with arguments %1, %2 and %3
    To use a FOR ... DO loop in a batch file you have to escape the '%' character by typing it twice, for example:
    Code:
    @echo off
    for %%X in (1,2,3,4,5) do echo %%X

    For a shell language, typically you donít get to know what command are available for use. You must know that a command exists to be able to use it. There are a couple of lists online though, like SS64, which Iíve linked in this post twice already, itís a really good one.
    This is the most recent A-Z list I know of on TechNet.
    Updated: November 23, 2015
    Applies To: Windows Server 2003, Windows Vista, Windows XP, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2000, Windows Server 2012, Windows 8
    https://technet.microsoft.com/en-us/...(v=ws.11).aspx
    Last edited by Bree; 28 Feb 2017 at 08:22.
      My ComputersSystem Spec

 


Similar Threads
Thread Forum
Improve Windows 10 with one-click batch files
I'm not sure if this is posted in the right section. gHacks - Improve Windows 10 with one-click batch files
Software and Apps
Solved Using Batch files to perform sequential tasks
Hi, I think I used to do this all the time but that was a long time ago. I want to open a Wordperfect (WP) document then run an executable program, the WP file opens fine but the executable won't run until I close the WP file. Any clues? ...
Software and Apps
Looking for a program to batch resize .png files.
I use Photoshop for .jpg files, but it can't seem to do .png. What programs can do this?
Software and Apps
Solved Batch files won't run, open editor instead
Somehow (most likely my fault) .bat files have defaulted to opening my text editor (UltraEdit) instead of executing. I took all the file associations out of UltraEdit and re-started - no change I followed internet advice to remove ...
Software and Apps
Batch Rename Deletes Files
Hey all, I just upgraded to Windows 10 last night, and I've been playing around with the new File Explorer. One thing I tried was the batch rename function (by which I mean just selecting multiple files and clicking "rename"). I quickly realized...
Performance & Maintenance
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:12.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums