Search found 187 matches

by Fawers
10 Apr 2012 10:43
Forum: DOS Batch Forum
Topic: How set name of batch as variable
Replies: 12
Views: 8594

Re: How set name of batch as variable

%0 is the full command as entered at the command line (when shift is not used). If you enter "c:\program files\widget\run.bat" then that entire string will be in %0 So "%~nx0" will only return "run.bat" As foxidrive stated, you can combine these letters in order to hav...
by Fawers
10 Apr 2012 10:39
Forum: DOS Batch Forum
Topic: How set name of batch as variable
Replies: 12
Views: 8594

Re: How set name of batch as variable

From the CALL command help: %~1 - expands %1 and removes any quotes (") on it %~f1 - expands %1 to a full, qualified path %~d1 - expands %1 to a drive letter %~p1 - expands %1 to a path %~n1 - expands %1 to a file name %~x1 - expands %1 to a file extension %~s1 - expands %1 to a short path and ...
by Fawers
09 Apr 2012 20:09
Forum: DOS Batch Forum
Topic: Save to a log file.
Replies: 3
Views: 4138

Re: Save to a log file.

Your code is fine, MrKnowItAllxx. There's only somethings I would change. In section :Login from for /f "tokens=1,2 delims=;" %%a in (login.log) do set User2=%%a set Pass2=%%b to for /f "tokens=1,2 delims=;" %%a in (login.log) do ( set User2=%%a set Pass2=%%b ) Because you put 2 ...
by Fawers
09 Apr 2012 19:56
Forum: DOS Batch Forum
Topic: Batch question on deleting!
Replies: 28
Views: 16605

Re: Batch question on deleting!

It's kind of difficult to think of a batch code that can do such specific things. I mean, in the start you told us you wanted the parent folder deleted if the current folder hasn't got any .ape's in it. Let's say we've got 3 folders: A, B and C. Both B and C are sub-folders of A. So the paths we wou...
by Fawers
08 Apr 2012 21:57
Forum: DOS Batch Forum
Topic: Batch question on deleting!
Replies: 28
Views: 16605

Re: Batch question on deleting!

IF the subfolders folders within C:\MUSIC\FLAC do NOT have a file with a .ape extension in them (Or any of there subdirectorys) THEN i want to delete it there root folder. I thought of this: @echo off cd /d C:\MUSIC\FLAC\JAZZ for /f "delims=" %%a in ('dir /b /s /ad') do ( if not exist &qu...
by Fawers
08 Apr 2012 21:08
Forum: DOS Batch Forum
Topic: Parent folder path from file path
Replies: 5
Views: 6956

Re: Parent folder path from file path

Yessir, I had been reading it before I even posted, but I somehow missed it whenever I was looking over everything =P Whenever you want to know about those "variable custom settings", you can take look both at the FOR command help and/or CALL command help. The only difference between them...
by Fawers
08 Apr 2012 17:28
Forum: DOS Batch Forum
Topic: Parent folder path from file path
Replies: 5
Views: 6956

Re: Parent folder path from file path

You can also add a 'd' to that variable.

Code: Select all

%~dpI

%~pI will return the path only. Adding that extra 'd' will give you the drive letter as well.