New
#21
If you are running the commands directly from the command line, then you need to change%%f
to%f
so basically%%f
only works in a batchfile.
For example, assuming that SetDpi.exe is in a folder C:\ My Tools (which has a space character in its name) and you're running the command from the command line,
So, to be able to run it within a batchfile instead of running it from the command line, we need to double the percentage signs:Code:for /f "tokens=*" %f in ('"C:\My Tools\SetDpi.exe" value') do if %f==100 ("C:\My Tools\SetDpi.exe" 200)else (if %f==200 "C:\My Tools\SetDpi.exe" 100)
The code from my previous post also works within a batchfile.Code:for /f "tokens=*" %%f in ('"C:\My Tools\SetDpi.exe" value') do if %%f==100 ("C:\My Tools\SetDpi.exe" 200)else (if %%f==200 "C:\My Tools\SetDpi.exe" 100)