Linked Questions

3 votes
2 answers
3k views

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.
Strictly No Lollygagging's user avatar
1306 votes
7 answers
1.4m views

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 ...
Sebastián Grignoli's user avatar
466 votes
17 answers
890k views

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?
Vhaerun's user avatar
  • 13.4k
30 votes
11 answers
113k views

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, ...
Heng-Cheong Leong's user avatar
2 votes
3 answers
10k views

I am studying batch programming and i cant literally distinguish between %~2 and %2 .Also mention an example please.
Mohit Yadav's user avatar
6 votes
3 answers
1k views

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 ...
user1075715's user avatar
3 votes
1 answer
4k views

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%
Sam's user avatar
  • 15.8k
0 votes
1 answer
5k views

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, ...
Rafael LGC's user avatar
2 votes
3 answers
4k views

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 ...
cafevincent's user avatar
1 vote
3 answers
3k views

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 ...
Gutsygibbon's user avatar
0 votes
1 answer
3k views

Could you please explain what does it mean in bat file: SET server=%~1
SimonD's user avatar
  • 1,567
0 votes
1 answer
2k views

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. ...
Ramiz Uddin's user avatar
  • 4,269
1 vote
1 answer
1k views

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 ...
Egalth's user avatar
  • 1,000
-1 votes
3 answers
2k views

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\...
STF's user avatar
  • 1,513
0 votes
1 answer
1k views

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 ...
user1229895's user avatar
  • 2,329

15 30 50 per page