I need to use CMD to echo these lines :
#ECHO OFF
cd C:\Program Files (x86)\Atelier Web\Remote Commander Pro\
awrcp.exe /r=test
goto end
:end
to .bat file
Well remove echo off. Really.
Related
I Made A Batch File Which Would Open In Notepad++ From The CURRENT DIRECTORY where the batch file is located(with run.. feature in notepad++), But I Want batch file to open on the folder where i have opened the file.
Example:
My Batch File Is Located In D:\Projects\Java\Executor Java.bat
I Have Opened A File Of .java Extension in D:\Java\Files
I Want to open at file location,i.e. D:\Java\Files
My batch file Looks like this:
#ECHO OFF
ECHO WELCOME TO EXECUTOR
ECHO -Garvit Joshi(garvitjoshi9#gmail.com)
ECHO USER:%USERNAME%
cd /d "%~dp0"
:first
ECHO LOOKING FOR FILES IN:"%~dp0"
set /p "input=Enter The File You Want To Execute:"
ECHO ===============================
javac %input%.java
ECHO ===============================
set /p "input=Enter The Class You Want To Run:"
ECHO ===============================
ECHO OUTPUT:
ECHO ===============================
java %input%
ECHO ===============================
pause
ECHO =======================================================
ECHO *******************************************************
ECHO =======================================================
goto first
You'll need to pass the path as a parameter from Notepad++ in the 'Run...' dialog, e.g:
cmd /c "D:\Projects\Java\ExecutorJava.bat $(CURRENT_DIRECTORY)"
..then have your batch file use the parameter with something like:
cd /d "%1"
(In this example, have removed the space from the "Executor Java.bat" filename for convenience)
can any one help me in this.
I want to run the cmd prompt through Bat file.
#echo off
cd ..
cd ..
dir /b w:\0*.jpg >abc.csv
pause
The above code collect all .jpg from w drive and will store in C drive as abc.csv
Is it not simply?
#echo off
cd ..
cd ..
dir /b w:\0*.jpg >abc.csv
start cmd || ::This line opens a new prompt.
pause
I am trying to get a batch file to create a folder on the desktop with a text file inside of it. Every-time i try to run this line of code it gives my the error that "The filename, directory name, or volume label syntax is incorrect."
echo ========================
::CREATE FILES START
cd /d C:
md Title
echo.>"C:\Users\%USERACCOUNT%\Desktop\Example\example.txt"
::CREATE FILES END
echo Done!
pause >nul
Your code is changing to drive C, then creating GeoHunt2015 in root. Then you try to echo the file into non-existent folder on desktop, hence the error.
This assumes your %userprofile% is "c:\users\name"
md "%USERPROFILE%\Desktop\GeoHunt2015"
echo.>"%USERPROFILE%\Desktop\GeoHunt2015\Mission_Instuctions.txt"
or you can cd to desktop
echo ========================
:: CREATE FILES START
cd /d "%USERPROFILE%\Desktop\"
md GeoHunt2015
echo. >"GeoHunt2015\Mission_Instructions.txt"
:: CREATE FILES END
echo Done!
pause >nul
Is %USERACCOUNT% defined?
Is the echo actually causing the issue?
Try commenting out stuff until you are sure that the echo is causing the syntax error.
A couple things I can see. You're switching to the C: directory, then making the GeoHunt2015 folder, but then attempting to echo into the GeoHunt2015 folder on your desktop.
Try this echo instead:
echo.>"C:\GeoHunt2015\Mission_Instructions.txt"
Try using
mkdir "C:\%USERPROFILE%\Desktop\GeoHunt2015"
echo.>"C:\%USERPROFILE%\Desktop\GeoHunt2015\Mission_Instuctions.txt"
as you had in your original version of the question.
I am trying to create a batch file that gets a zipped folder for that particular date (v_date) from the sftp site and then unzip them. The zip file contains five files that are text documents. I have written batch scripts that successfully get the zip file from the remote site and save a copy of it on the local drive. I need to incorporate the unzip part in to my script.
SET v_date=%1
if [%v_date%] == [] SET v_date=%date:~10,4%%date:~4,2%%date:~7,2%
echo option batch continue>FTP_File_Get.txt
echo option confirm off>>FTP_File_Get.txt
echo open Target>>FTP_File_Get.txt
echo lcd "M:\Development\Data History\File" >> FTP_File_Get.txt
echo cd /Export/File >> FTP_File_Get.txt
echo get /Export/File/Filename_%v_date%.zip "M:\Development\DataHistory\Filename_%v_date%.zip">>FTP_File_Get.txt
echo exit>>FTP_File_Get.txt
M:\temp\apps\WinSCP\winscp.com/script="M:\Development\SFTPBatchFiles\FTP_File_Get.txt"
del FTP_File_Get.txt
This is my code to UNZIP:
SET v_date=%1
if [%v_date%] == [] SET v_date=%date:~10,4%%date:~4,2%%date:~7,2%
cd "M:\Development\Data History\"
::SET v_file="M:\Development\Data History\Filename_%v_date%.zip"
::unzip -o %v_file%
"C:\Program Files\7-Zip\7z.exe" e "Filename_%v_date%.zip"
I need to move the extracted files (6 Files) into their respective folders, Any help is greatly appreciated
To unzip the files you can use this command line:
"C:\Program Files\7-Zip\7z.exe" e "filename.zip"
#echo off
set "source=%userprofile%\Desktop\basanta\Automation\a"
set "target=%userprofile%\Desktop\basanta\Automation\b"
FOR %%A IN ("%source%\*.gz") DO (
"%programfiles%\7-zip\7z.exe" x "%%~A" -o"%target%\%%~pA"
del "%%~A" /Y
)
Use the above code by saving it to .bat file extension
Remember %userprofile% is for the directory, %programfiles% for the program files set as a variable in windows
hope that helps
My batch file contains a START command that runs a short vbscript program. When the batch file completes, the code of the vbscript program is shown in an open Wordpad window. This only started happening after we converted to Windows 7. Never happened under XP. Why does this happen and how can I prevent it? I have done extensive internet searching and come up with nothing.
Here is batch file:
#echo off
cls
echo.
echo Copying Latest Version of FREDS Database ...
echo.
xcopy "\\sstore02\S-Drive.OOD\OPI\FREDS\FREDS.mdb" "K:\FREDS\" /i /q /y
echo.
echo If you see "1 File(s) copied" then the copy was successful
echo.
echo Copying Shortcut Installer ...
echo.
xcopy "\\sstore02\S-Drive.OOD\OPI\FREDS\FREDS-Shortcut.vbs" "K:\FREDS\" /i /q /y
echo.
echo If you see "1 File(s) copied" then the copy was successful
echo.
echo Adding Shortcut icon to Desktop ...
echo.
Start K:\FREDS\FREDS-Shortcut.vbs
echo.
pause
You need to call cscript instat of start.
cscript /nologo K:\FREDS\FREDS-Shortcut.vbs
The option /noscript hides the version of cscript in the output.
Notepad is the registered program for the VBS extension on your machine.
Right click a VBS file and select Open With and then navigate to cscript.exe in c:\windows\system32 folder usually. Select the checkbox to always use that program and then the start command will work with VBS scripts and Cscript.