Please have a look at the following commands and what was the error in syntax? i wanted to copy the dll file to my project bin directory
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WinForms\10.0.0.0__b03f5f7f1
1d50a3a>dir /s /b /o:gn
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WinForms\10.0.0.0__b03f5f7f1
1d50a3a\Microsoft.ReportViewer.WinForms.dll
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WinForms\10.0.0.0__b03f5f7f1
1d50a3a>copy Microsoft.ReportViewer.WinForms.dll C:\Documents and Settings\mural
i.madhava\My Documents\Visual Studio 2008\Projects\Rdclrender\Rdclrender\bin
The syntax of the command is incorrect.
Quite simply you need to place quotes around any path that has a space in it:
copy Microsoft.ReportViewer.WinForms.dll "C:\Documents and Settings\murali.madhava\My Documents\Visual Studio 2008\Projects\Rdclrender\Rdclrender\bin"
If you have spaces in your paths (such as C:\Documents and Settings), you'll need to surround them with quotes to stop them being treated as multiple arguments:
copy blah.WinForms.dll "C:\Documents and Settings\blah\bin"
This gives you the three-argument command:
copy
blah.WinForms.dll
C:\Documents and Settings\blah\bin
Without the quotes, you get the five-argument command which is not what you want:
copy
blah.WinForms.dll
C:\Documents
and
Settings\blah\bin
Related
i want to use
where /r C:\Program Files (x86)\ used.cs
but it says i can't use them! how can i use the program files x86 without that error!
please help fast
You forgot to quote your path, otherwise where can't know that Files or (x86) is part of the path and used.cs is not!
where /r "C:\Program Files (x86)" used.cs
When I'm using Xcopy command in CMD to copy and replace a file from the user's download location to another location, I'm getting invalid number of parameters.
Here's my code:
xcopy /y C:\%userprofile%\downloads\XXXXt\XXXX C:\Program Files (x86)\XXX\XXX\common\XXXX\XXXX\Managed\XXXX
The XXX's represent game files for which we are replacing to mod the game.
%USERPROFILE% includes the drive letter. Replace C:\%USERPROFILE% with just %USERPROFILE%.
There are space in Program Files (x86), so you need to place the destination in double quotes.
Overall, the command should then be xcopy /y "%userprofile%\Downloads\XXXX\XXXX" "C:\Program Files (x86)\XXX\XXX\common\XXXX\XXXX\Managed\XXXX".
Excel is installed at C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE
Folder where the files is at C:\Heffalump files
The name of a example file is Auto the heff.xlsx
Been toying with a bat file to run that excel file but cant get it to work. The above should have been
"C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" "C:\Heffalump\Auto the heff.xlsx"
when running the bat:
"C:\MyAwesomeBat.bat" "Auto the heff.xlsx"
But it keeps the quotes so it gets all messed up.
cls
#SET ScheduledExcel=true
#SET ScheduledExcelFolder="C:\Heffalump files"
#SET ScheduledExcelFilePath=%ScheduledExcelFolder%\%1
"C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" %ScheduledExcelFilePath%
You need to enclose the entire argument into quotes, not only parts of it. Your 2nd SET statement includes the quotes into the value; after appending %1, you'll have a quote in the value.
The following should work:
CLS
#SET ScheduledExcel=true
#SET "ScheduledExcelFolder=C:\Heffalump files"
#SET "ScheduledExcelFilePath=%ScheduledExcelFolder%\%~1"
"C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" "%ScheduledExcelFilePath%"
I enclosed the entire SET expression in quotes, so they do not become part of the value.
Note also the ~ in %~1 which removes surrounding quotes if there are any.
Whenever you set a variable to a string, it's generally good practice to quote the set "variable=value" pair. That way the value doesn't contain the quotes, but you also avoid evaluating tricky characters like &. Then you can explicitly quote at retrieval time when needed.
Also, aschipfl correctly points out that you need to include a tilde in %~1 to strip the surrounding quotes from the command-line argument.
#echo off
setlocal
cls
SET "ScheduledExcel=true"
SET "ScheduledExcelFolder=C:\Heffalump files"
SET "ScheduledExcelFilePath=%ScheduledExcelFolder%\%~1"
"C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" "%ScheduledExcelFilePath%"
For what it's worth, unless you intentionally installed Office to that folder, isn't Office typically located in C:\Program Files (x86)\Microsoft Office\Office15 or similar? Regardless, as Mahran hinted, you don't actually need to specify the full path to excel.exe. If Windows has .xlsx files associated with Excel, then you can either
start "" "%ScheduledExcelFilePath%"
or
call "%ScheduledExcelFilePath%"
or most simply
"%ScheduledExcelFilePath%"
Simply on you bat file write this code
call C:\Heffalump\heff.xlsx
The following windows 7 batch file script returns the error:
#ECHO OFF
if exist C:\Program Files (x86)\ E1\P45V goto WIN7
ren /s /c "c:\Program Files\ E1\P45V\P45Login.bmp" "c:\Program Files\E1\P45V\P45Login_OLD.bmp"
copy "\\locattion14\temp\E1\P45Login.bmp" "c:\Program Files\ E1\P45V\P45Login.bmp"
goto END
:WIN7
ren /s /c "c:\Program Files (x86)\ E1\P45V\P45Login.bmp" "c:\Program Files (x86)\E1\P45V\P45Login_OLD.bmp"
copy "\\locattion14\temp\E1\P45Login.bmp" "c:\Program Files (x86)\ E1\P45V\P45Login.bmp"
:END
The syntax of the command is incorrect
Using PSTOOLs to push out a change to computers, and will add the list when the syntax error is corrected.
The desired result:
If the pc is an XP machine, rename the P45login.bmp file to same name_OLD.bmp, then copy the file from loaction 14 into the directory noted.
If the PC is a Win 7 machine, skip the first part, go to the second part, and commit the same changes.
close the session.
I have moved quotes, added/subtracted switches, but arrive at the same error.
Surely it is just a simple syntax particularity that I am not catching.
Hoping someone will take a look, see the obvious I am missing, and point me in the right direction,.
Thank you for any help or suggestions.
Your ren syntax is wrong. ren does not support any switches and also rename_to needs to be name only, not full path. See full details here: http://technet.microsoft.com/en-us/library/cc754276%28v=ws.10%29.aspx
Additionally:
- if exists needs quotes around path
- you use both \ E1\ or \E1\ (with or without space). While both could be valid, I would double check if that's not an error.
- if the paths above are actually different, you need to use move (with full paths) instead of ren.
I wrote this script to first install the msi and then copy my application to a temporary directory. But none is working. When the windows.bat file is executed it failed to find package\ and also dist directory
1) User downloaded and execute the windows.bat file which has following tree:
C:\Users\Username\Downloads\windows.bat
C:\Users\Username\Downloads\package\<.msi files>
C:\Users\Username\Downloads\dist\<application files>
2) windows.bat contain below:
msiexec /I "package\files.msi" /qb
set temp=%TEMP%
echo %temp%
xcopy dist %temp% /e /h /R
All fails, to run with windows.bat file. What am i doing wrong?
You need to add the following line to the beginning of your batch file:
cd c:\users\username\downloads
alternatively, you can do this:
cd /d %~p0
%~p0 will take argument #0 (the full path to the batch file) and extract the path from it. The /d option will make sure to also change the current drive if the given path contains a drive specification.
Ok, think I know what's wrong. msiexec.exe runs from the Windows System folder (e.g. C:\Windows\Systeme32) so when you pass it the name of the msi file to install, you need to include the full path to it.
So, using #MikeNakis' info about getting the current path within the batch file, try this (slight tweak to use %~dp0 for just the directory, so not including the batch file name too):
msiexec /I "%~dp0\package\files.msi" /qb
Ensure you are in the correct directory to start off with
CD /d c:\users\%USERNAME%\downloads
As the first line in your batch file