Check if the input is a file or folder

I have a command like this: set /p txtfile=Write destination to the .txt file: now i need to know if the file really exists so: if exist %txtfile% echo file found. it works, but if the user writes me C:\ it will display "file found" to. I want t

Importing data with bcp

I would like to import data in the file 'c:_value_.txt' to my database like this Bcp mydb.mytable in 'C:\_value_.txt' -T -c -Smypc\instancename However I keep getting the error Unable to open BCP host data -file Why is this?Lose the single quotes aro

Use find to return only the number

I have an external process which essentially needs to call: int myInt = exec('find /v /c "" filepath'); It's counting the number of lines in a text file. If there's a better way to get the integer amount that'd also work great. With find, the fu

Pass parameters to a bat file, then pass them to a php script

I having trouble passing command line parameters, that were passed to a bat file, onto a php script This is what I have: @echo off echo %1% set foo=%1% php %~dp0%myscript.php %1% %2% %3% The first three lines work. The 4th line works if it is just: p

Deleting the PATH path from the system in a batch script

I am trying to remove a variable path from the system's PATH environment variable from within a batch script. For example, if MY_DIR=C:\MyDir, I want to remove MY_DIR from PATH. I've tried setlocal EnableDelayedExpansion call setx /M PATH %%PATH:%MY_

Start a task after finishing another

In a .vbs i have something like Dim sh Set sh = WScript.CreateObject("WScript.Shell") 'run conf sh.run "cmd /K php -c php.ini -f some_path\runer\run.php & pause",0,false 'Navigate to the nginx folder to run server sh.run "cmd

Batch sending output to null does not work

When I run this code if there is no Num.txt it says that it cant find the file. how do i stop it from saying this i have tried >nul but it doesn't seem to be making any difference. @echo off for /f "delims=" %%x in (Num.txt) do set "d=%%

Make any command in CMD works in a .BAT file as a .EXE file

Redirecting CMD Commands To An EXE File Long story short, basically I have the problem that every time I run BCDedit on the .BAT that I converted into an .EXE it never worked and I thought that the reason why it wasn't work was because it wasn't on P

Defining variables in the batch variables

I'm trying to efficiently name variables a1 through a9 with !%f%! through !%q%!. I tried creating a for loop to complete this: set w=0 for %%K in (f g h i k l m o q) do ( set /a w+=1 set /a b%w%=%!%%K!% set /a a%w%=!b%w%!%%13 ) The error is that ther

srvany.exe does not start the .bat file

(OS: Windows 7) Using SC.EXE I have created a Windows Service. Additionally, I created the necessary registry entries to specify the Application path (using key Parameters). The "Application" is a .BAT file that sets several environment variable

Batch renaming of .7k files

I want to rename files using the command prompt with a prefix of 'g_x_'. The structure of the original file names are: 000_1565.7k I have tried: ren *.7k g_x_*.7k That code will rename the files to 'g_x_1565.7k', but i really need the files to be nam

Chain manipulation using the lot

Below is the crud output of my batch script "kxip12","triss-s16-vm","","triss-db02-vm","false","true","false","MySQL","false"," "," ","PTROW

calculate the date -10 days

I am new in batch script. Currently my file is showing in below format. i want the details output where date should be 10days before the currentdate (means date-10). Currently its is showing in latest date 00000064 xxyz 2013-06-17 14:37:11 00000065 x

Clear text printed on the command line with Java

How I can clear text that prints in command line with Java? I want to clear Text1 after prints and overwrite with Text2. I search and find this code but it don't work. public class className { public static void main(String[] args) throws IOException

case-sensitive file in cmd.exe

I just experienced a search dir *T.java in a cmd.exe giving back SortedArrayList.java as well as ReaderT.java (my Test class filename structure). I can't infer a case sensitivity switch from the help output of dir /?. Is there still a way though? Add

C # process / cmd output analysis in variables

I'm making gui to rtmp-plugin that is commandline program. I need way to read output data from cmd program to three variables: downloaded, time and done. In cmd output is exsample "3000 kb / 12 sec (12%)" without "". How I can get 3000