Newest cmd Questions

Q&A for professional and enthusiast programmers

how to use environment variable in batch file

I am noob in using batch files, Ok I have added visstudio system variable with value C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe so echo %visstudio% will give me the ...

Trying to merge files with logic to fill in missing data. * building a flat database?

I'm trying to merge files with logic, to fill in missing data. I'm having issues with if errorlevel @echo off SETLOCAL enableDelayedExpansion del /q porttemp.csv del /q database.csv rem CMD BATCH-...

MySql updating table using cmd and getting the % value of one column

I want to edit the salary of all the customers by getting 0.25% who are born by before 1985 so here is the table. http://imgur.com/a/naWPN what'd be the syntax to get this value? http://imgur.com/a/...

Append to a text file via batch script does not work

All, Here is my code to create a cfg file via batch scripting. It adds the first line but does not append anything after that. FOR /F "tokens=1,2* delims==" %%a IN ('TYPE !oTcPath!') DO ( ...

Creating Script to fill out javascript form

Objective: Write a one click script to change IP address of a device through its Javascript form. Hi! I am trying to write a script to fill out a form on a Javascript. I need to change three values ...

To print data to a text file except first column [on hold]

I have a file links.txt: 1 a b c 3 b d 6 c j k l I want to print data from links.txt to another text file except the first column. Desired output in a text file: a b c b d c j k l

Calling 2to3 in Python using cmd

I have a folder of .py files written in Python 2.7 that I want to convert to Python 3 using the 2to3 tool. Using windows 10 in the cmd prompt i can convert a single file with the following command: C:...

Open an admin command prompt / power shell admin and execute a command in the RUN window

So Basically what im trying to do is open a RUN window and type a line of code that will open an admin cmd/powershell and run a cmd at the same time so i want this all on one line and as simple as ...

Assign User to net use to change another users password

Is it possible to assign a user to make net use run as a certain person(admin) to change another users password? Like so?: "/c net user /user:domain\Administrator <admin-pwd> username password ...

Batch script to copy data base on current date & modified date?

I need copy outlook data from users to my NAS server every 2 times/month on 1st & 14th and copy file at users log on to windows. Copy from Source to NAS server. This is my idea! If (current ...

composer suddenly doesn't work on cmd

I was trying to install laravel after i installed composer and made sure it's working by typing composer on my cmd but right after i added this line on cmd i became unable to see composer command ...

Running a long PowerShell Cmd from the RUN window with highest privileges on one line

I am almost there, so this "works" but i need to do exactly that with an admin powershell. My user is administrator The cmd HAS to be run from the RUN window (windows R) at once the user can click ...

Makefile on windows: unable to locate cmd.exe directory

I am facing an issue when I try to run a Makefile on windows (working with Cygwin). I have this line of code: cat command.bat | "$(cmddir)" cmddir was defined as cmddir := /C/Windows/System32/...

What does 'adb forward internal error mean?

i have one device attached to pc having usb device enabled(from developer option) im trying to send command line forward to device like this adb -d forward tcp:5037 tcp:5037 but gives internal ...

Handle DISM errors from PowerShell script

How can I capture errors when using DISM tool from PowerShell script? & cmd /c 'DISM /online /disable-feature /NoRestart /featurename:[feature_name] >NUL 2>&1' if ($LASTEXITCODE -ne 0) ...

How to disable USB port via command prompt before a user connects?

My problem is very similar to: How disable and enable usb port via command prompt? https://support.microsoft.com/en-us/help/823732/how-can-i-prevent-users-from-connecting-to-a-usb-storage-device But ...

Execute commands in CMD on Windows with Java code

I want to write a Java code that would perform commands in Windows CMD. I looked through the site and found out how to send and work with single request. For example create new Process and in ...

error while using Forfiles command

I want to move a file from one server to another but getting error while using the below command If Exist "D:\pkr\test.txt" %_ff%forfiles /p "D:\pkr\" /m "test.txt" /c "cmd /c echo @file && ...

Execute script when opening new terminal IntelliJ Idea

In my idea terminal (based on windows) I use an alias doskey ll=dir each time I open a new terminal (so if i prompt ll make a dir). There is a way to execute by default a command (a script will be ...

“CALL ”C:\Program Files\nodejs\\node.exe" Error

I have been trying insall node js and install browser sync C:\Users\Aly>npm install -g browser-sync 'CALL "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files `(x86)\nodejs\\` node_modules\...

Where do I find good books on Windows 7 command line and batch scripting? [on hold]

I am looking for a good book, or a series of books that teaches Windows 7 command line, DOS, and batch scripts. I own the 3-volume series by D Armstrong Learn Command Line and Batch Script Fast, ...

.BACKUP file extension could be open in PC

I have an .backup file in hike messenger.i have to open it on my PC to read a file.Is there any possibilities to read or any softwares to read a messages

Windows CMD / BATCH Command - FC command showing matching above/below lines

I want to compare 2 text files using cmd.exe's fc command. However, it is printing the line above and line below of the mismatched line too. How do I suppress this behaviour? a.txt 32=10500.3000000 ...

Batch file mangling a string with special chars and quotes inside a FOR loop

This code snippet below is stripped of all the extra junk, down to just the error-generating code, )"" was unexpected at this time. @echo off SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS Set "...

Exiting batch script after it starts

I have this batch script: C:\{Directory}\PsExec.exe -u {UserName} -p {Password} \\{IP_Address} /accepteula "C:\batchfiles\{BatchScript}.bat" And the {BatchScript}.bat script is: C:\{Directory}\...

Batch script to find a value in the first column of text file based on the parameters

I have a file links.txt: 1 a b c 21 b d 14 c j k l 5 d r e test.bat 1: @echo off for /f "tokens=*" %%c in ('findstr /b "%*" links.txt') do ( echo %%c ) I passed "1" as parameter to test.bat and ...

How to display a message while opening cmd? [duplicate]

Help me that how can I display a default/custom message everytime when I open cmd in windows8/10.

Using IF inside FOR loop with piped content inside CMD

I am writing one batch setup program, and I have to check version of java during the setup. In order to do that I use the following code in my batch: JAVA -version 2>&1 | FOR /F "USEBACKQ ...

Issue when copying two text files using the copy command

I am having an issue when attempting to copy two files into a separate file using the Windows Copy command. In the first file, when I open the text file in notepad I see the data in the file formatted ...

Batch Script to replace a folder inside a 3rd level subfolders

I am trying to come up with a batch file that will perform the following: List all folders of a determined route. Go into these folders, and look into their 3rd subfolder level and search another ...

How to write in the first line of a text file with cmd? [duplicate]

I searched but I did not find the answer I want. I have an existing file that contains several lines and I want to write a line that will now be the first line. Example : echo toto >> file.txt ...

Redirecting command output to stdout and pipe in batch files

Ok so I have this script where I redirect the output of an ant command to a pipe with findstr ant xyz | findstr ... but as you know the output of the command will not get displayed on the stdout. So ...

Granting Permissions Recursively using PSFTP command

I wrote a batch script to copy files from my local machine to server as below and I am running this from my local machine. Script: echo cd /server_path/MyFolder >>batch_file.txt echo lsd c:\...

CMD/Batch: How to use the output of a FOR /F loop in another set of commands

New to stackoverflow and coding in general. I was able to write a batch that parses a text file for a set of IP address of the sonos players on a network, I was also able to write a separate batch ...

Potential Level 3 Communication Problems via TraceRt?

I have waited for the past 3 days to see if these problems would fix themselves, but I'll go ahead and explain what has been happening as it appears many of you guys can actually ingest a wall of ...

Using Windows cmd as the visual studio dev cmd

I'm currently learning C/C++ programming in university. We have been using the visual studio developer cmd to compile all our code. Recently, I learned I could set custom paths for the CMD, and have ...

How to make CMD show result instead of string in SET variable

I am looking to implement a simple batch file that will rename the current local profile folder, backup registry keys then delete profile list SID keys. Therefore allowing the computer to create a new ...

PHP 7.0.9 & php_mysql.dll

I've latest version of xampp with php 7.0.9. I've installed Magento 2 on it, Admin panel and forntend works fine but when i execute Magento cron using Windows Task Scheduler CMD windows prompt error ...

unable to write in line variable writing in batch cmd [on hold]

I apologize for the vagueness of my question. I wanted to be able to take information and stack it in a file, the pull the information from the file in line. The way that I am able to do this at ...

Windows 7 Group Policy Software Restriction Policies on cmd.exe issue

Hope this will be specific enough. I'm currently settings some restriction on my Win7 machine, initially i disable the cmd.exe (command prompt) by adding into Software Restriction Policies with the ...

Running a cmd through PhP

TL;DR: I'm trying to run a web-based server on PhP. I know PsExec would work, but it looks buggy. If anyone got another thing than PsExec that would do the trick, I'm willing to try it. (Or a ...

CMD IF EXIST evaluation time

I have a computer inside a windows domain that uses a mapped home drive I: and I have a logon script (via GPO) that is supposed to do something on that drive. From my observations I would guess that ...

How to swap odd and even lines in a text file? [on hold]

I have a text file. I have to swap odd and even lines. I made a batch script that writes even lines into testfile2.txt and odd lines into testfile3.txt. @echo off setlocal EnableDelayedExpansion ...

Firebird: Permission Denied?

I opened Firebird ISQL Tool to create a database (I assume thats right?) and I typed in the "create database 'path_here'" command to create my database. When I pressed enter, it asked me for a CON ...

Can't Decide value of ERRORLEVEL

I have a batch script that loops on the output of an ant call and checks if a string exists in the output, if the string exists we move on to the next step, else we terminate the execution.. Here's a ...

Get hour without space %time:~0,2% [duplicate]

I am giving files names that includes their creation dates. I have done it like this so far: filename%date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt It seemed to work fine ...

Escaping outputs in CMD

If I run something that returns with a & or some other character that has special meaning, and I try to use it in a script, how would I escape it? An example would be if I shared a local account ...

unable to delete folder [on hold]

I have a folder in a External Hard Drive when i try to delete it, it says that the file has been moved, and when i try to check the path of the folder it starts with "\?\", to compare with other ...

Generate shellcode by using msfvenom

according to this video he used msfpayload & msfencode to genarate shellcode for cmd command. msfpayload windows/exec cmd=calc.exe R | msfencode -e x86/alpha_mixed -t c -v But now, metasploit ...

Robocopy with exclusion list

I'm trying to use ROBOCOPY to move all files, folders, and subdirectories from one location to another. There are some files that SHOULD NOT be moved. I want to store a list of these files that are ...
Translating... 0%