Linked Questions
19 questions linked to/from What does %~d0 mean in a Windows batch file?
3 votes
2 answers
3k views
Windows Batch: What does the "~" do? [duplicate]
I was just wondering what the "~" symbol does in a batch file, I know that it's associated with variables. Can I have some examples of what it does? Thanks.
1306 votes
7 answers
1.4m views
What does %~dp0 mean, and how does it work?
I find %~dp0 very useful, and I use it a lot to make my batch files more portable. But the label itself seems very cryptic to me... What is the ~ doing? Does dp mean drive and path? Does the 0 refer ...
466 votes
17 answers
890k views
Iterate all files in a directory using a 'for' loop
How can I iterate over each file in a directory using a for loop? And how could I tell if a certain entry is a directory or if it's just a file?
30 votes
11 answers
113k views
Find the path of notepad.exe and mspaint.exe
What is the best way to find out where notepad.exe and mspaint.exe are that will work across various versions of Windows? Should I get the Windows directory via SHGetFolderPath(NULL, CSIDL_WINDOWS, ...
2 votes
3 answers
10k views
Difference between %~2 and %2 in batch programming?
I am studying batch programming and i cant literally distinguish between %~2 and %2 .Also mention an example please.
6 votes
3 answers
1k views
Translating DOS batch file to PowerShell
I am trying to translate a .bat file to PowerShell and having trouble with understanding what a few snippets of code is doing: set MY_VARIABLE = "some\path\here" "!MY_VARIABLE:\=/!" What is line 2 ...
3 votes
1 answer
4k views
What does ".\" mean in a batch file?
In the context of The directory where your SQL scripts are. Defaults to .\ does .\ represent the directory you are currently in? What about ..\? What about SET DIR=%~d0%~p0%
0 votes
1 answer
5k views
Inno Setup: How to run an installed batch file programmatically
How to run a bat file in the Code section (procedure DeinitializeSetup)? As I tried to do: Exec('"' + installationFolder + '\mysql\db\db.cmd"', '"'+ installationFolder +'"', '', SW_SHOW, ...
2 votes
3 answers
4k views
batch scripting: how to get parent dir name without full path?
I'm working on a script that processes a folder and there is always one file in it I need to rename. The new name should be the parent directory name. How do I get this in a batch file? The full path ...
1 vote
3 answers
3k views
How to use a notepad file full of Server names to execute a command using batch?
Im using the sc command to query the services running on machines and was using code similar to: sc \\"server_name" query | find "SERVICE_NAME" > servicelist2.txt so basically all the server ...
0 votes
1 answer
3k views
What does SET server=%~1 mean in a Windows batch file?
Could you please explain what does it mean in bat file: SET server=%~1
0 votes
1 answer
2k views
How do I know the default batch file directory?
I'm creating a batch file for SharePoint deployment. The batch will do solutions installation and configuration, create a web application and restore the .dat file on the created web application. ...
1 vote
1 answer
1k views
Batch file: Pass file name to sub from FOR loop
This question is about the correct syntax for passing file name arguments to a subroutine in a batch file. Feels like this question should have been asked before, but I can't seem to find the right ...
-1 votes
3 answers
2k views
how to install apk from pc using relative path
I'm trying to install apk file from my PC on my android device and I have a problem. when I erite these code it's all ok adb install "C:\Users\ntuser\Documents\workspace\Team\apps\_sample\samples\...
0 votes
1 answer
1k views
BAT :~ syntax for strings
I see the ':~' symbols used pretty often in BAT files, I presume it gets a character at a position, but I couldn't find any confirmation of this, nor on how/when to use it (it appears it can get a ...