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

Discus and support do we still have %~ in batch files in windows 10 in Windows 10 Support to solve the problem; 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... Discussion in 'Windows 10 Support' started by zivshosh, Feb 27, 2017.

  1. zivshosh Win User

    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

    :)
     
    zivshosh, Feb 27, 2017
    #1

  2. How to save batch of files in c drive

    We are volunteers willing to help you try to resolve this issue.

    Use File Explorer (icon on the Taskbar of the Desktop or Use Cortana and type in File Explorer) then navigate to the old folder and COPY (hold shift to highlight many files or CTRL to copy individual files in a group) then go to where you want them on the C:
    or whatever drive you will be using on the computer and PASTE. Afterwards you can Delete the original copies in the previous fold if the new copies are OK.

    Or you can do the same except use CUT instead of Copy (Cut removes the files when you do the paste).

    Windows 10 - Help <-- Syncing and Saving

    https://support.microsoft.com/en-us/products/wi...

    Please let us know the results and if you need further assistance.
     
    SpiritX MS MVP, Feb 27, 2017
    #2
  3. Rohn007 Win User
    How to save batch of files in c drive

    If you are trying to save to the "root", C:\, that is a bad idea.

    Please describe what you want to do in more detail. There are many ways to copy or save files. The "best" way depends on what you want to do and what tools you are most comfortable with.

    Where are these files coming from?
     
    Rohn007, Feb 27, 2017
    #3
  4. Pyprohly Win User
    Hi,

    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.

    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.
     
    Pyprohly, Feb 27, 2017
    #5
  5. This isn't my thread, but thanks for that link anyway.
     
    Wiley Coyote, Feb 27, 2017
    #6
  6. Bree New Member
    %~ is interesting, and proves there's always more to learn (well, it's new to me) and, yes, they work in Win10.

    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[/quote] 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[/quote]
    This is the most recent A-Z list I know of on TechNet.
    https://technet.microsoft.com/en-us/...(v=ws.11).aspx
     
    Bree, Apr 4, 2018
    #7
Thema:

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

Loading...
  1. do we still have %~ in batch files in windows 10 - Similar Threads - still batch files

  2. We are on windows 11 but clipboard still have issues...

    in Windows 10 Gaming
    We are on windows 11 but clipboard still have issues...: Is there a way I can make sure that when I press for 100th time ctrl c or use context menu on mouse my content is getting copied ...? It's annoying, honestly to repeat this over and over...
  3. We are on windows 11 but clipboard still have issues...

    in Windows 10 Software and Apps
    We are on windows 11 but clipboard still have issues...: Is there a way I can make sure that when I press for 100th time ctrl c or use context menu on mouse my content is getting copied ...? It's annoying, honestly to repeat this over and over...
  4. Windows Batch File

    in Windows 10 Network and Sharing
    Windows Batch File: I am performing a backup using xcopy with /e/y/d. One folder is giving me a problem. The source looks like this: Level 1 ----------...
  5. Windows Batch File

    in Windows 10 Gaming
    Windows Batch File: I am performing a backup using xcopy with /e/y/d. One folder is giving me a problem. The source looks like this: Level 1 ----------...
  6. Windows Batch File

    in Windows 10 Software and Apps
    Windows Batch File: I am performing a backup using xcopy with /e/y/d. One folder is giving me a problem. The source looks like this: Level 1 ----------...
  7. When do we have WSLg for windows 10?

    in Windows 10 Installation and Upgrade
    When do we have WSLg for windows 10?: WSLg is great for windows 11, but when do we have WSLg for windows 10. Why not provider WSLg for win11 and win10 at the same time.This remind me of old microsoft all over again....
  8. Can we execute a batch file when we switch virtual desktops?

    in Windows 10 Customization
    Can we execute a batch file when we switch virtual desktops?: If we can't do this now: In the following text, when the word batch is used but makes less sense than the word script, mentally replace the word batch with the word script Can Microsoft create a program that executes a batch file whenever a new virtual desktop is chosen?...
  9. Create batch files with Batch?

    in Windows 10 Software and Apps
    Create batch files with Batch?: How to create Batch and VBS files with Batch? So I write a batch file which I then convert to exe that creates new folders in a certain directory and then creates batch and VBS files with a certain content and saves them in the created folder. So it's similar to a program...
  10. Do We Have Batch Files For Bit Locker in Window 10 Home

    in AntiVirus, Firewalls and System Security
    Do We Have Batch Files For Bit Locker in Window 10 Home: Just to know an idea that Do We Have Batch Files For Bit Locker in Window 10 Home, If we can have batch file for it than how can be used and from where can i get the batch files for Bit Locker in Window 10 Home....