I have used itextsharp library to generate pdf in my asp.net web application. It was working fine untill today when suddenly my laptop on which the application was running in the debug mode went off. When I switched on my laptop again and tried to run the application I satrted getting this error:
"Could not load file or assembly 'itextsharp, Version=5.5.0.0,
Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its
dependencies. The parameter is incorrect. (Exception from HRESULT:
0x80070057 (E_INVALIDARG))"
What could be the reason and how can I solve this? Please help.
Try removing the reference and add again...!!! Seems like the reference got removed due to improper shutdown.
Try to clean Temporary Files of Asp.Net, sometime I've experimented strage cases of files corruption(I know this should be a comment but It's verbose):
1 - Open notepad and paste the following.
#ECHO OFF
ECHO Performing IIS Reset
IISRESET
ECHO Deleting Cache
Del /F /Q /S %LOCALAPPDATA%\Microsoft\WebsiteCache\*.*
Del /F /Q /S %LOCALAPPDATA%\Temp\VWDWebCache\*.*
Del /F /Q /S “%LOCALAPPDATA%\Microsoft\Team Foundation\3.0\Cache\*.*“
Del /F /Q /S “C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\*.*“
Del /F /Q /S “C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\*.*“
Del /F /Q /S “C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\*.*“
Del /F /Q /S “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\*.*“
ECHO Complete
2 - Save the file as a .bat file.
3 - run it from the command prompt.
I had a backup of my project. Restored the backup and it worked. Thanks for all the suggestions.
Related
I am trying to get a batch going to backup a folder on a work server. (Please see attached link)
Bat Error "invalid number of parameters"
Long story short - I need the script to name a new folder for each backup, which "md new_folder" was suggested, but I cannot seem to get the context or how to place it into the code.
#echo This will now create a new backup of S:\Internal Auditor\9 - September 14
#echo off
:: variables
set SRCFOLDER="S:\Internal Auditor\9 - September 14"
set DESTFOLDER="S:\Internal Auditor\2014\9 - Sept Backup"
set folder=%date:~5,2%-%date:~8,2%-%date:~0,4%
set backupcmd=/W /E /H /V /C /Z /I /F /J /R /Y
echo ######## PLEASE WAIT SYSTEM BACKINGUP SOME DATA########
"md new_folder" xcopy %SRCFOLDER% %DESTFOLDER% %backupcmd%
echo !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!!
#pause
Any help would be greatly appreciated!
----------EDIT:
I tried a line of code that slowly got me closer:----------
#echo This will now create a new backup of S:\Internal Auditor\9 - September 14
#echo off
:: variables
set SRCFOLDER="S:\Internal Auditor\9 - September 14"
set DESTFOLDER="S:\Internal Auditor\2014\9 - Sept Backup"
set folder=%date:~5,2%-%date:~8,2%-%date:~0,4%
md "%DESTFOLDER%\%folder%"
set backupcmd=/W /E /H /V /C /Z /I /F /J /R /Y
echo ######## PLEASE WAIT SYSTEM BACKING UP SOME DATA########
xcopy %SRCFOLDER% "%DESTFOLDER%\%folder%" %backupcmd%
echo !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!!
#pause
BUT - I am getting the following output:
This will now create a new backup of S:\Internal Auditor\9 - September 14
Access is denied.
Error occurred while processing: S:\Internal.
A subdirectory or file Auditor\2014\9 already exists.
Error occurred while processing: Auditor\2014\9.
A subdirectory or file - already exists.
Error occurred while processing: -.
A subdirectory or file Sept already exists.
Error occurred while processing: Sept.
A subdirectory or file Backup\9/-9/-Tue already exists.
Error occurred while processing: Backup\9/-9/-Tue .
######## PLEASE WAIT SYSTEM BACKING UP SOME DATA########
Invalid number of parameters
!!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!!
Press any key to continue . . .
----------EDIT 2: I tried a line of code that slowly got me closer:----------
I have followed the suggestions and some things I found online, and now I am to the point where I am getting a few errors:
md "S:\Internal Auditor\~\09/12/2014"
A subdirectory or file S:\Internal Auditor\~\09/12/2014 already exists.
And:
xcopy "S:\Internal Auditor\9 - September 14 S:\Internal Auditor\2014\9 - Sept Backup\09/12/2014
/W /E /H /V /C /Z /I /F /J /R /Y /D
File not found - 09/12/2014 /W /E /H /V /C /Z /I /F /J /R /Y /D
This is my code:
#echo This will now create a new backup of S:\Internal Auditor\9 - September 14
Rem Backup 9 - September 14
#echo
:: variables
set "SRCFOLDER=S:\Internal Auditor\9 - September 14"
set "DESTFOLDER=S:\Internal Auditor\2014\9 - Sept Backup"
set folder=%date:~4%
md "%DESTFOLDER%\%folder%"
set backupcmd=/W /E /H /V /C /Z /I /F /J /R /Y /D
#echo ######## PLEASE WAIT SYSTEM BACKING UP SOME DATA########
xcopy "%SRCFOLDER% %DESTFOLDER%\%folder% %backupcmd%"
#echo !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!!
#pause
Also, when I run the code, it makes a new directory ~\09\12\2014 instead of the desired ~\09/12/2014.
Clarification:
It makes 3 new subdirectories instead of one new subdirectory.
Okay let's see what you're doing. Your variable folder is being set based on your local settings for a short date, which for me shows e.g. Tue 09/09/2014 so your %date:~0,4% would be Tue. Use the echo command to be sure you're getting what you want:
echo %date:~5,2%-%date:~8,2%-%date:~0,4%
But let's assume for now you already figured that out and %folder% contains what you want it to. This is two commands on a line, which won't work at best at at worst is going to create a bunch of folders you didn't expect:
"md new_folder" xcopy %SRCFOLDER% %DESTFOLDER% %backupcmd%
You want to split that into 2 lines, and you want to use your new date-based folder name as part of the destination, I'm sure. So this will do that:
md "%DESTFOLDER%\%folder%"
and then to copy you'd need to include \%folder% in your destination:
xcopy %SRCFOLDER% %DESTFOLDER%\%folder% %backupcmd%
But I think, and I know I shouldn't ask for clarification but perhaps if I'm wrong you should clarify what you need a bit more in your question, you really want that S:\Internal Auditor\2014\9 - Sept Backup to be S:\Internal Auditor\ plus the value in %folder% and not having the date the way it is in that path.
Suggestion: Make the %folder% variable to be yyyy-mm-dd format such as 2014-09-09 so it's sortable, and use that in your destination.
Ok. There are some errors:
set SRCFOLDER="S:\Internal Auditor\9 - September 14"
set DESTFOLDER="S:\Internal Auditor\2014\9 - Sept Backup"
Must be (safe method, adding first quote at start of SRCFOLDER and DESTFOLDER):
set "SRCFOLDER=S:\Internal Auditor\9 - September 14"
set "DESTFOLDER=S:\Internal Auditor\2014\9 - Sept Backup"
I created a wix bundle which was working properly before codesigning. After googling and checking wix documentation, I got to know that I need to use insignia.exe for code signing the wix bundle. Please any idea on how to use this tool. Thanks in Anticipation.
I use the next command sequence (it's a part of my cmd file. Certificate is stored in a file on hard drive. If you want to sign your installer by the certificate from the store just fix signing part. All result code check is omitted)
set INSIGNIA_PATH="C:\Program Files (x86)\WiX Toolset v3.8\bin\insignia.exe"
rem Detach engine
del /q engine.exe
%INSIGNIA_PATH% -ib Setup.exe -o engine.exe
rem Sign engine
SignTool.exe sign /f certificate.pfx /p CERT_PASSWORD /t TIMESTAMP_URL engine.exe
rem Attach engine
%INSIGNIA_PATH% -ab engine.exe Setup.exe -o ProductSetup.exe
rem Sign bundle
SignTool.exe sign /f certificate.pfx /p CERT_PASSWORD /t TIMESTAMP_URL ProductSetup.exe
I found a way to uninstall IE 10 using a batch file which below and it works great like it's suppose to. It uninstalls and restarts the computer after about a minute.
FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-10..mum /c "cmd /c echo Uninstalling package #fname && start /w pkgmgr /up:#fname /norestart /quiet"
shutdown -r
But I wanted to take this further and Hide IE 10 from windows updates which will prevent windows to install this update actually in the future and to do that, Microsoft provides an executable file which you can download from here
http://www.microsoft.com/en-us/download/details.aspx?id=36512 After extracting this executable, you get 3 files, IE10_Blocker.adm, IE_blocker.cmd and IE10_BlockerHelp.htm and Microsoft instructions are "In the Command Prompt, goto the folder where you have extracted these 3 files and type “ie9_blocker.cmd /B” and hit Enter to set the blocker on the machine."
I decided to make one batch file for all this so right now I got this far.
FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-10..mum /c "cmd /c echo Uninstalling package #fname && start /w pkgmgr /up:#fname /norestart /quiet"
mkdir “C:\IE10”
copy /Y \file01p\Users\test\public\IE Update blocker\IE10*.* “C:\IE10”
start /d C:IE10\IE10_Blocker.cmd /b
shutdown -r
mkdir “C:\IE10” This command is suppose to create the directory called IE10 on C drive
copy /Y \file01p\Users\test\public\IE Update blocker\IE10*.* “C:\IE10” This command will copy those executable from the network public folders to their C:\IE10 which I just created in the previous step.
This script doesn't work. Only up to uninstalling IE 10 it works but it doesn't create the directory and so it doesn't copy the files from the network. How can do this?
Thanks
Thanks
Try running your batch as administrator.
in an administrator : command prompt it makes the directory without issue.
also, it could be that you do not have access to make the directory on C:
you could try locating it elsewhere that you are sure you have write access.
I am trying to install an application and a group of services using PSTools, but I want to take into account that the computer I am trying to connect to may be turned off or on a different network, which is not reachable from the internal network.
Basically if the machine is not able to be accessed through the admin share, this is the message that I am getting:
Couldn't access MachineName:
The network path was not found.
Make sure that the default admin$ share is enabled on MachineName.
This is the syntax I am using to try to capture the "Error Message" and then report back that if installation was successful or not (depending on if it can contact the machine)
#echo off
set /p name=What is the machine name?:
psexec.exe \\%name% -u *useraccount* -p *password* \\ServerName\installation.bat
FOR /F "tokens=*" %%A IN ('COMMAND ^| FIND "Couldn't access"') DO SET Error=%%A
If "%Error%"=="Couldn't access"
ECHO Installation Failed.
Else
ECHO Installtion complete.
Pause
exit
Currently it hangs right at the point it's defining the Error Variable. Can't quite figure out what I am going wrong here.
'COMMAND ^| FIND "Couldn't access"' opens a command shell, which is why it hangs. It will not proceed until that shell is exited.
You will need to look at redirecting the error messages to another file. 2>Errors.txt on the psexec line will give you a file to search in the next line.
this will make the batch file look something like this:
#echo off
set /p name=What is the machine name?:
psexec.exe \\\%name% ... \\\ServerName\installation.bat 1>Error.txt 2>&1
for /f "tokens=*" %%A in ('FIND /i error.txt "Couldn't Access"') do SET Error=%%A
If not x%ERROR:Couldn=%==x%ERROR% (
ECHO Installation Failed.
) Else (
ECHO Installtion complete.
)
Pause
exit
(Also, notice the use of brackets to make a multi line IF)
the check for if will see if Couldn is part of the string, as a direct comparison will not work, as you would have to check against the whole string including the machine name
I created a custom windows service in Visual Basic using Visual Studios '05.
The service is on our server which is running Windows Server 2003. I have installed the service, and it runs perfectly when I go into Computer Management and Start the service manually.
I have created a batch file to start the service using the NET START command. Whenever I run the batch file, the service doesn't start. I get this message from the command prompt:
The 'Service Name' is starting.
The 'Service Name' could not be started. The service did not report an error. More help is available by typing NET HELPMSG 3543.
I'm not sure what to do. (Been "googling" for a couple of hours.) It starts up when I manually run it, but it wont start via the batch file. Thanks!
Try forcing it to elevate in the batch file.
#ECHO OFF
:: Automatically elevate...
#ECHO OFF
SETLOCAL
:: Check if script was run with administrator privilages
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: If the error flag is set, we do not have admin.
IF "%ERRORLEVEL%"=="0" GOTO GOTADMIN
:UACPROMPT
ECHO. Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
ECHO. UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%TEMP%\getadmin.vbs"
EXIT /B
:GOTADMIN
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
CD /D "%~dp0"
ENDLOCAL
GOTO SCRIPTSTART
:: THE ACTUAL SCRIPT STARTS HERE
:SCRIPTSTART
NET START [whatever service]